哈哈~ idhttp控件做post程序 为什么是 http/1.0呢~?

vicky_jam 2005-09-28 10:52:30
我用idhttp控件做post程序
他默认发包时候 版本是 HTTP/1.0
如:
POST /1.jsp HTTP/1.0


我怎么才能设置它为 http/1.1呢??
哈哈 谢谢~
...全文
335 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
fei19790920 2005-09-28
  • 打赏
  • 举报
回复
HTTP.ProtocolVersion :=pv1_1 ;
xixuemao 2005-09-28
  • 打赏
  • 举报
回复
哈哈~
ly_liuyang 2005-09-28
  • 打赏
  • 举报
回复
呵呵,简单问题来的:)

_____________________
http://lysoft.7u7.net
S.F. 2005-09-28
  • 打赏
  • 举报
回复
ProtocolVersion 默认属性应该是 1.1 ,如果不是,则按 ProtocolVersion :=pv1_1 设置
S.F. 2005-09-28
  • 打赏
  • 举报
回复
怎么不行?你debug 步进一下看看吧

pv1_1;的处理流程如下:

///////////////////////////////////////////////
call : BuildAndSendRequest(nil);
///////////////////////////////////////////////
send : FHTTP.WriteLn('POST ' + Request.URL + ' HTTP/' + ProtocolVersionString[FHTTP.ProtocolVersion]);
///////////////////////////////////////////////
declare: ProtocolVersionString: array[TIdHTTPProtocolVersion] of string = ('1.0', '1.1');
///////////////////////////////////////////////
// PLEASE READ CAREFULLY

// Currently when issuing a POST, IdHTTP will automatically set the protocol
// to version 1.0 independently of the value it had initially. This is because
// there are some servers that don't respect the RFC to the full extent. In
// particular, they don't respect sending/not sending the Expect: 100-Continue
// header. Until we find an optimum solution that does NOT break the RFC, we
// will restrict POSTS to version 1.0.
if Connected then
begin
Disconnect;
end;
OldProtocol := FProtocolVersion;
// If hoKeepOrigProtocol is SET, is possible to assume that the developer
// is sure in operations of the server
if not (hoKeepOrigProtocol in FOptions) then //看这里
FProtocolVersion := pv1_0;
DoRequest(hmPost, AURL, ASource, AResponseContent);
FProtocolVersion := OldProtocol;
///////////////////////////////////////////////


你所需要做的就是打开HTTPOptions属性下的hoKeepOrigProtocol ,设置为true
vicky_jam 2005-09-28
  • 打赏
  • 举报
回复
老大 我设置了 但是还是不行~:(

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧