G
gisnewcomer
Unregistered / Unconfirmed
GUEST, unregistred user!
本人写了如下代码:
Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), 'HTTP/1.1',
nil, Pointer(AcceptTypes), Flags, Integer(Self));
ActionHeader := SHTTPSoapAction + ':'
HttpAddRequestHeaders(Request, PChar(ActionHeader), Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
HttpAddRequestHeaders(Request, PChar(ContentHeader), Length(ContentHeader), HTTP_ADDREQ_FLAG_ADD);
WireData := UTF8Encode(S);
InternetSetOption(Request, INTERNET_OPTION_USERNAME, Pchar(FUserName)
, length(FUserName)+1);
InternetSetOption(Request, INTERNET_OPTION_PASSWORD,
Pchar(FPassword), length(FPassword)+1);
HttpSendRequest(Request, nil, 0, @WireData[1], Length(WireData)));
结果发现支持服务端返回的含content-length标记的数据包。但是如果服务端采用chunked标记的包,就无法接受数据包,出现错误。
找了很多资料,没发现怎么处理,才能让客户端支持chunked数据包。希望高手指点一下,代码怎么处理,才能解决这个问题?
Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), 'HTTP/1.1',
nil, Pointer(AcceptTypes), Flags, Integer(Self));
ActionHeader := SHTTPSoapAction + ':'
HttpAddRequestHeaders(Request, PChar(ActionHeader), Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
HttpAddRequestHeaders(Request, PChar(ContentHeader), Length(ContentHeader), HTTP_ADDREQ_FLAG_ADD);
WireData := UTF8Encode(S);
InternetSetOption(Request, INTERNET_OPTION_USERNAME, Pchar(FUserName)
, length(FUserName)+1);
InternetSetOption(Request, INTERNET_OPTION_PASSWORD,
Pchar(FPassword), length(FPassword)+1);
HttpSendRequest(Request, nil, 0, @WireData[1], Length(WireData)));
结果发现支持服务端返回的含content-length标记的数据包。但是如果服务端采用chunked标记的包,就无法接受数据包,出现错误。
找了很多资料,没发现怎么处理,才能让客户端支持chunked数据包。希望高手指点一下,代码怎么处理,才能解决这个问题?