New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post request sometimes hangs when ssl is used with multi_socket #1170
Comments
Thank you for the log but unfortunately this is not enough information to tell you what's wrong. Can you provide a self-contained example that we can use to reproduce? Also, are you sure that your program loaded the latest version of libcurl w/openssl? Can you do a curl_version() to confirm? |
That trace was gotten using the ubuntu compiled curl (without debugging). Here is a new one using the one compiled by me (printed version at the top):
|
Here I atached an example program you could use to try this issue. If you execute it several times you will realize that not always works when using https instead of http. The only IP that worked for my was 37.58.71.74. |
What strikes me in the above trace is the socket callback log with the remove action just after getting te certificate, in fact, I do not even getting the log of transfer done when calling on curl_multi_info_read once all stuff finishes. |
Perhaps the problem is on the SSL layer, maybe try setting CURLSSLOPT_ALLOW_BEAST option. |
Jus tried, but it does not solve the problem |
Maybe a7b38c9 solves the issue? |
Not it does not. Here is a trace using the example program provided above, using curl master branch which includes that patch: Curl version: libcurl/7.52.2-DEV OpenSSL/1.0.2g zlib/1.2.8 c-ares/1.10.0 libidn2/0.10 librtmp/2.3
|
Based on your output, the commit I mentioned changed the behavior at least. When it times out, it seems it waits for incoming data. Maybe it should actually send data at this point? It is curious that we've not seen this problem before though. Is there any way we can reproduce this problem in our ends? |
Yes, you can try it using the sample code I attached in a previous message. It's quite strange because it only happens with the multi_socket interface. If I use the easy API it works perfectly. |
But is there a public URL or set of URLs you try to fetch with that code that trigger this issue? A generally pretty convenient way to debug the multi_socket API is to build a debug enabled curl and run the command line with |
I can reproduce this in Windows using boost 1.6.3 and asiohiper without any modifications to the example. I'm not sure what it is yet. When I connect to an https website using the asiohiper example it ends prematurely. I can see in the debugger the boost event loop is returning prematurely for some reason. Can you try asiohiper unmodified using an https url? |
@jay, can you try the |
|
Hi guys, |
Hi @sancane, I happen to be working on libcurl with asio and found some possible errors. However, I ran the code you provided and the behavior is a little different than yours. On the other hand, you did mention that the ghiper.c version is working. |
Hi, here you have my modified version of the ghiper.c. It's neraly the same code expect I removed the fifo management and added the url to make the POST using htttps. |
@sancane I noticed that the behavior I encountered was similar to the one you posted before @bagder proposed a7b38c9. So I switched libcurl to master and try again, and it seems to be running correctly row. Maybe you'd like to have a try, just merge #1192 into the asio code. The program log looks like this on my env now: |
@Aulddays It seems that your patch fixes the problem. Great job! |
Thanks guys! |
Hi,
I'm developping an http c++ client library with libcurl to send POST requests to Rollbar application which provides a REST API (https://rollbar.com/docs/api/). That server uses a load balancer, so every time a new POST is issued, a different server will attend the request. I'm using multi_socket interface to do this stuff and I realized that curl only is successful to send the POST payload with just one server among all other ones that are provided by the load balancer.
I first thought that it could be a problem regarding the server configuration. So I tried using the easy interface to make requests but all of them worked fine with any server that the load balancer provided. The problem only happens when using the multi_socket API with ssl. (wihout SSL everything work like a charm).
Looking at the wireshark traffic, tls handshake seems to go on well, but when it finishes the POST payload is never sent, the application seems to do nothing until the socket timeout expires and connection is closed.
curl/libcurl version
I tried 7.47.0 provided with ubuntu 16.04.1 LTS, without success and then compiles my own.
And here is the one I compiled (master branch):
I also enabled debug when compiled it, set CURLOPT_VERBOSE on my program and installed my own debug function with CURLOPT_DEBUGFUNCTION to print as much as possible. Here is the trace I got whe it hangs to send the POST
Here I would expect that the payload set for the POST request started being sent once the handshake is done.
The text was updated successfully, but these errors were encountered: