1
IdConnectionInterceptOpenSSL->SSLOptions->Method = sslvSSLv23;
IdConnectionInterceptOpenSSL->SSLOptions->Mode = sslmClient;
IdConnectionInterceptOpenSSL->SSLOptions->VerifyDepth = 0;

//....

TCHAR* SIR = SIRX[ix].c_str();

AnsiString rtf;
TStringStream * Send = new TStringStream(rtf) ;
Send->Write(SIR, (SIRX[ix]).Length());  // <-- new
Send->Position = 0;

TMemoryStream *Receive = new TMemoryStream() ;

AnsiString ADRESA = "https://webservicesp.anaf.ro:443/PlatitorTvaRest/api/v1/ws/tva";

IdHTTP->Request->Accept = "application/json";
IdHTTP->Request->ContentType = "application/json";
IdHTTP->Request->Connection = "Keep-Alive";

IdHTTP->Post(ADRESA, Send, Receive);

If I use a direct Internet connection, it works fine.

My problem appear when I use a proxy server for Internet connection.

I put

IdHTTP->Request->ProxyServer = PROXY_SERVER;
IdHTTP->Request->ProxyPort = StrToInt(PROXY_PORT);
if(PROXY_USER.IsEmpty() == false)
    IdHTTP->Request->ProxyUsername = PROXY_USER;
if(PROXY_PASSW.IsEmpty() == false)
    IdHTTP->Request->ProxyPassword = PROXY_PASSW;

But the error appears like this : connection closed gracefully to the first interrogation, and after, the same interrogation give 501 Not Implemented.

Where is the problem? Are there any solutions?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Daniel
  • 29
  • 2
  • Why are you using Indy 8? That is a long-dead version that is no longer being supported. Please upgrade to Indy 10 preferrably, or at least Indy 9. What kind of proxy are you actually using? `TIdHTTP` in Indy 8 only supported HTTP proxies. Indy 9 supports HTTP and SOCKS proxies, and Indy 10 supports those as well as custom proxies. – Remy Lebeau Sep 26 '16 at 21:58

0 Answers0