mdsantos 0 Posted March 13 Hi, I have some legacy application written in C++ Builder XE4. Our client asked us to change some Webservices call to https TLS 1.2. And then problems started. We tried to use Indy HTTP to do this, but only TLS 1.0. was available, after a lot of digging and try outs, we were able to update Indy Components in XE4 (using the documentation available at https://github.com/IndySockets/Indy/wiki/Updating-Indy) and now we are able to do the call using TLS 1.2 The problem now it's that the idHTTP post request is very slow to receive an response (it takes about a minute or more), using Postman it's less than a 1 sec. Here is the code snippet: TIdSSLIOHandlerSocketOpenSSL *SSLHandler = new TIdSSLIOHandlerSocketOpenSSL(NULL); TIdHTTP *IdHTTP1 = new TIdHTTP(NULL); SSLHandler->SSLOptions->Method = sslvTLSv1_2; //(we add to force this, otherwise we got the "Error connecting with SSL. error 1409442E:SSL routine:ssl3_read_bytes:tlsv1 alert protocol version") IdHTTP1->IOHandler = SSLHandler; IdHTTP1->Request->CustomHeaders->AddValue("X_API_KEY", "somevalue"); IdHTTP1->Request->ContentType = "application/json"; //IdHTTP1->Request->ContentType = tipo->Text; UnicodeString json = "[JSON DATA]"; // Replace with your JSON data TStringStream *ss = new TStringStream(json); UnicodeString response = IdHTTP1->Post("https://TheServiceURL", ss); // ---> THIS TAKES ABOUT 1 MINUTE TO EXECUTE ShowMessage("Response Rest: " + response); Some help would be appreciated. Thank you. Share this post Link to post
Remy Lebeau 1436 Posted March 13 2 hours ago, mdsantos said: The problem now it's that the idHTTP post request is very slow to receive an response (it takes about a minute or more), using Postman it's less than a 1 sec. Unless you are sending a massively large JSON, or receiving a massively large JSON, then it should not be taking anywhere near that long to encode/decode the data. So I have to assume that either 1) you are on a very slow network, or 2) the response from the server is really taking that long to transmit. Use a packet sniffer to check that, as well as to compare the Postman traffic to the TIdHTTP traffic any differences. Share this post Link to post
mdsantos 0 Posted March 14 It's not the case. The json is small, just 237 chars. Also tested with postman in the same machine, it took 1 sec to reply. Restarted the machine, and... the problem was gone, strange. Even so the Indy upgrade was not a smooth ride. We follow the documentation, step by step: - Automated Uninstall script for XE4 Clean_X4.cmd - removing the packages from the IDE - Build the indy project (C++ Builder) with the Fullc_XE4.bat - Setting the lib paths Lib\core, lib\system, lib\protocolos but I got error installing the new packages. "Impossible to locate the specific module". Share this post Link to post
Remy Lebeau 1436 Posted March 14 That error message doesn't necessarily mean the specified file can't be found. It can also mean that a DLL/BPL that the specified file depends on can't be found. Unfortunately, Windows doesn't differentiate between those two cases. But what you can do is use a tool like SysInternals Process Monitor to see exactly which file is not being found and where exactly Windows is looking for the file. That may give you some better clues. Share this post Link to post