Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
uIdHttp
#1
I'm using idHttp and TIdSSLIOHandlerSocketOpenSSL, it works on the local machine, but on the server when running, the error "unknown protocol" occurs.

Indy version I use is 10.6.2.0


Code

  lHTTP := TIdHTTP.Create(nil);
  try
    lHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
    TIdSSLIOHandlerSocketOpenSSL(lHTTP.IOHandler).SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_2,sslvTLSv1_1];
    lHTTP.ProtocolVersion := pv1_0;
    Result := lHTTP.Get(aUrl);

  finally
    lHTTP.Free;
  end
Reply
#2
(11-23-2022, 01:01 PM)piaulino Wrote: I'm using idHttp and TIdSSLIOHandlerSocketOpenSSL, it works on the local machine, but on the server when running, the error "unknown protocol" occurs.

That error happens only under 1 situation - when the URL being requested is incomplete, specifically when it does not begin with either 'http:' or 'https:', and does not specify a port number explicitly, and a port number was not already established from an earlier request on the same TIdHTTP object (ie, when requesting a relative URL after requesting an absolute URL).

What is the actual value of your aUrl string?

Reply
#3
(11-24-2022, 03:32 AM)rlebeau Wrote: What is the actual value of your aUrl string?

Actual value is "https://dominio.com.br?sso=2423442342&token=fijfasjarwieiwerutiewurtutweoir739428kfnfn"

return json string
Reply
#4
(11-25-2022, 12:58 PM)piaulino Wrote: Actual value is "https://dominio.com.br?sso=2423442342&token=fijfasjarwieiwerutiewurtutweoir739428kfnfn"

If that is true, you should not be getting that error raised with the code you have shown, eg:

Code:
aUrl := 'https://dominio.com.br?sso=2423442342&token=fijfasjarwieiwerutiewurtutweoir739428kfnfn';
lHTTP := TIdHTTP.Create(nil);
try
  lHTTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(lHTTP);
  TIdSSLIOHandlerSocketOpenSSL(lHTTP.IOHandler).SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_2,sslvTLSv1_1];
  // lHTTP.ProtocolVersion := pv1_0;
  Result := lHTTP.Get(aUrl);
finally
  lHTTP.Free;
end;

The only way I can think of for you to be getting that error raised is if the server is redirecting you to an invalid URL. Are you getting the TIdHTTP.OnRedirect event fired before the error is raised? If not, then you need to provide a reproducible example.

That being said, are you sure that URL is even valid? When I try that URL in my browser, it is not able to connect to 'dominio.com.br'. I can't even ping that hostname, or find it in a DNS lookup.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)