idhttp访问出现onnection closed gracefully

Posted suhq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了idhttp访问出现onnection closed gracefully相关的知识,希望对你有一定的参考价值。

idhttp=new TIdHTTP(NULL);
idhttp->AllowCookies =true;
idhttp->HandleRedirects =true; //允许重定向
idhttp->ConnectTimeout =20000;
idhttp->ReadTimeout =20000;
//hoInProcessAuth, hoKeepOrigProtocol, hoForceEncodeParams, hoNonSSLProxyUseConnectVerb, hoNoParseMetaHTTPEquiv, hoWaitForUnexpectedData, hoTreat302Like303, hoNoProtocolErrorException, hoNoReadMultipartMIME, hoNoParseXmlCharset, hoWantProtocolErrorContent, hoNoReadChunked
idhttp->HTTPOptions <<hoKeepOrigProtocol;  //这一句很关键
//pv1_0, pv1_1
idhttp->ProtocolVersion =pv1_1;

SSLIO=new TIdSSLIOHandlerSocketOpenSSL();
//sslvSSLv2, sslvSSLv23, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2
SSLIO->SSLOptions->Method = sslvTLSv1_2;
//sslmUnassigned, sslmClient, sslmServer, sslmBoth
SSLIO->SSLOptions->Mode = sslmClient;
SSLIO->ConnectTimeout =20000;
idhttp->IOHandler=SSLIO;

以上是关于idhttp访问出现onnection closed gracefully的主要内容,如果未能解决你的问题,请参考以下文章

idhttp访问https

idhttp访问https

delphi idhttp在ADSL断网重连后会出错,是怎么回事?

delphi idhttp怎么填请求参数

idhttp post 出现exception class EIdSocketError with message 'Socket Error # 10054的解决办法(捕捉异常,防止程序挂掉

delphi 使用idhttp+TIdMultiPartFormDataStream 上传表单post文件并解决ssl问题