Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
lots of TidHTTP errors occurring
#2
(06-24-2023, 03:17 AM)cnielsen4211 Wrote: These programs have been working both locally and on VPS for years.

All of sudden I'm now getting these error messages randomly and fairly frequently

Has anything changed recently in your code? Did you change the OpenSSL DLLs recently (which version are you actually using)?

If not, then something must have changed on the server side instead.  Did you try contacting the server admins to ask?

(06-24-2023, 03:17 AM)cnielsen4211 Wrote:
Code:
httpClient.Request.AcceptEncoding  := 'gzip, deflate';

You SHOULD NOT be setting that property manually, unless your code is prepared to handle those formats manually.  Which, the code you have shown is not.

Instead, you should be assigning an object to the TIdHTTP.Compressor property, such as TIdCompressorZLib, and let TIdHTTP internally manage the AcceptEncoding property based on the Compressor's actual capabilities.

(06-24-2023, 03:17 AM)cnielsen4211 Wrote:
Code:
httpClient.Request.ContentType    := 'application/json;';
httpClient.Request.Charset        := 'utf-8';
httpClient.Request.ContentLength  := sizeof(Params);

The use of sizeof() is wrong.  If you are sending JSON, the Params must use a TStream object, such as a TStringStream, in order to hold/send the JSON data properly.  In which case, you must set the ContentLength to the value of the stream's Size property instead.  Or, you can simply omit the ContentLength and let TIdHTTP set it for you.

(06-24-2023, 03:17 AM)cnielsen4211 Wrote:
Code:
  sslIOHandler.PassThrough := false;  { added friday 20230623}  //https://quality.embarcadero.com/browse/RSP-29900  hasn't solved problem

That RSP refers to using SSL/TLS with a plain TIdTCPClient. That issue does not affect TIdHTTP, as it internally manages the SSLIOHandler.PassThrough property based on the type of URL being requested.

(06-24-2023, 03:17 AM)cnielsen4211 Wrote:
Code:
sslIOHandler.SSLOptions.Method :=  sslvSSLv3;
sslIOHandler.SSLOptions.sslversions := [sslVTLSv1, sslVTLSv1_1,sslVTLSv1_2,sslvSSLv3];
// sslIOHandler.SSLOptions.Method := sslvSSLv3;  // tried lots of versions of SSL none solved the problem
// sslIOHandler.SSLOptions.SSLVersions := [sslvSSLv3];

First, you should not be using the SSLOptions.Method property at all, it was deprecated a LONG time ago in favor of the SSLOptions.SSLVersions property.

Second, WHY are you enabling SSL v3.0??? Nobody uses that anymore, as it was compromised almost a decade ago.  DO NOT enable anything below TLS 1.0 nowadays:

Code:
sslIOHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

Reply


Messages In This Thread
RE: lots of TidHTTP errors occurring - by rlebeau - 06-28-2023, 01:44 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)