Conversation

blacktea

Hi, all!

Case:
We've got a client that sends messages to a server. I came across a problem when client failed to write request body. I found out that the reason was the connection was closed after the "keep-alive" timeout expired.
They use HTTP/1.1 and Keep-Alive connection.

Tcpdump trace:
image

155 - client, 159 - server.
At the beginning, the client sends a request and accepts a response from the server. Then, in 19 secs FIN packet is arrived. At 209.852367 we try to write headers. In response, we accepts RST packet. In cpprestsdk it means "Broken pipe" at https://.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client_asio.cpp#L1303.

My solution:
There is an attempt to restore the closed connection at https://.com/microsoft/cpprestsdk/blob/master/Release/src/http/client/http_client_asio.cpp#L1347.
I decided to use this method to handle body write error.
I managed to reproduce the error in unit-tests.

@ghost

CLA assistant check
All CLA requirements met.

@blacktea

@barcharcraz, Could you review please?

Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

@blacktea