pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.33k stars 2.15k forks source link

HTTPClientSession KeepAlive and setMaxKeepAliveRequests #4458

Closed micheleselea closed 6 months ago

micheleselea commented 7 months ago

In HTTPClientSession::write there's a code to try "reconnect and resend" if a connection is keepalive and we got an Exception That is nice, but same behavior happens, often (I think always) in HTTPClientSession::receiveResponse with ssl connesions

Consider for example this environment HTTPClientSession -> HTTPServer

we configure HTTPServer with setMaxKeepAliveRequests(10) An HTTPClientSession will connect make 10 requests without problem, than the HTTPClientSession server side is closed. The 11th HTTPClientSession request will do a HTTPClientSession::write without problem but obviously the receiveResponse will fail with Poco::Net::ConnectionAbortedException or Poco::Net::NoMessageException and your request is lost. I think it's more complicated to deal with that error as for the ::write function, probably we should automatically "reconnect write and receive" but I understand it's not simple as in write What do you think?