Home > Back-end >  Idhttp post data returned more than 255 bytes for less than the problem
Idhttp post data returned more than 255 bytes for less than the problem

Time:10-03

Each big recent research WEBQQ, heartbeat packets where to POST the data returned more than 255 bytes will not receive any data, returns an empty value, studies the along while don't know why, did you know help me greatly, 100 distribution

Below is the code:

 function TCommunication. WebQQPoll2 (var Str: TStringStream) : string; 
Var
The Response of PostData: TStringStream;
The begin
CoInitialize (nil);//initialize the COM libraries
IdHTTP:=TIdHTTP. Create (nil);
IdCookieManager:=TIdCookieManager. Create (nil);
IdSSLIOHandlerSocketOpenSSL:=TIdSSLIOHandlerSocketOpenSSL. Create (nil);
Response:=TStringStream. Create (' ', TEncoding GetEncoding (65001));
//Response. Size:=99999;
PostData:=TStringStream. Create (' r=% 7 b % 22 clientid % 22% % 22 '3 a + WebQQClientid +' % 22% 2 c % 22 psessionid % 22% % 22 '3 a + psessionid +' % 22% 2 c % 22 key % 22% 3 a0%2 c % 22 ids % 22% % 5 b % 5 d % 3 a 7 d & amp;='+ WebQQClientid +' clientid & amp; Psessionid='+ psessionid);
Try
Result:=';
IdHTTP. AllowCookies:=False;
IdHTTP. HandleRedirects:=True;
IdHTTP. CookieManager:=IdCookieManager;
IdHTTP. IOHandler:=IdSSLIOHandlerSocketOpenSSL;
IdCookieManager. OnNewCookie:=IdCookieManagerNewCookie;
IdHTTP. HTTPOptions:=[hoInProcessAuth, hoKeepOrigProtocol hoForceEncodeParams];
IdHTTP. ProtocolVersion:=pv1_1;
IdHTTP. Request. Accept:='*/*';
IdHTTP. Request. AcceptEncoding:='gzip, deflate';
IdHTTP. Request. AcceptLanguage:='useful - CN;
IdHTTP. Request. CacheControl:='no - cache;
IdHTTP. Request. Connection:='Keep - the Alive;
IdHTTP. Request. ContentType:='application/x - WWW - form - urlencoded';
IdHTTP. Request. Host:='d.web2.qq.com'.
IdHTTP. Request. Referer:='http://d.web2.qq.com/proxy.html? V=20110331002 & amp; The callback=1 & amp; Id=2 ';
IdHTTP. Request. UserAgent:='Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) ';
IdHTTP. Request. CustomHeaders. Text:='Cookies:' + Cookies;
IdHTTP. Post (' http://d.web2.qq.com/channel/poll2 ', PostData, Response);
//Response. SaveToFile (' c: \ 1234. TXT);
If the Trim (Response. DataString)='then
The begin
The Exit;
end;
Str. The Clear;
Str. Position:=0;
Str. LoadFromStream (Response);
Result:=ReadJson (Trim (Response. DataString), "retcode");
The finally
The Response. Free;
PostData. Free;
IdCookieManager. Free;
IdSSLIOHandlerSocketOpenSSL. Free;
IdHTTP. Free;
CoUninitialize ();
end;
end;
  • Related