mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
improved HTTPClientSession error handling for network errors handling during sending the request
This commit is contained in:
@@ -164,7 +164,10 @@ protected:
|
|||||||
|
|
||||||
void setException(const Poco::Exception& exc);
|
void setException(const Poco::Exception& exc);
|
||||||
/// Stores a clone of the exception.
|
/// Stores a clone of the exception.
|
||||||
|
|
||||||
|
void clearException();
|
||||||
|
/// Clears the stored exception.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ void HTTPClientSession::setKeepAliveTimeout(const Poco::Timespan& timeout)
|
|||||||
|
|
||||||
std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
||||||
{
|
{
|
||||||
|
clearException();
|
||||||
_pResponseStream = 0;
|
_pResponseStream = 0;
|
||||||
|
|
||||||
bool keepAlive = getKeepAlive();
|
bool keepAlive = getKeepAlive();
|
||||||
@@ -229,6 +230,7 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
|||||||
std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response)
|
std::istream& HTTPClientSession::receiveResponse(HTTPResponse& response)
|
||||||
{
|
{
|
||||||
_pRequestStream = 0;
|
_pRequestStream = 0;
|
||||||
|
if (networkException()) networkException()->rethrow();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -210,6 +210,13 @@ void HTTPSession::setException(const Poco::Exception& exc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTTPSession::clearException()
|
||||||
|
{
|
||||||
|
delete _pException;
|
||||||
|
_pException = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
StreamSocket HTTPSession::detachSocket()
|
StreamSocket HTTPSession::detachSocket()
|
||||||
{
|
{
|
||||||
StreamSocket oldSocket(_socket);
|
StreamSocket oldSocket(_socket);
|
||||||
|
|||||||
Reference in New Issue
Block a user