HTTPClientSession response transfer failure

Please post support and help requests here.
Posts: 4
Joined: 10 Jan 2013, 13:40

HTTPClientSession response transfer failure

Postby slimshader » 21 Jan 2013, 17:25


I am trying to add error handling for network/server failure when receiving HTTP response. Docs say:

n case a network or server failure happens while reading the response body from the returned stream, the stream state will change to bad or fail.

Problems is it seems that fail() returns true even for successful transfers when using StreamCopier:

Code: Select all

std::istream& is = session.receiveResponse(response);

if (response.getStatus() == HTTPResponse::HTTP_OK)
  Poco::StreamCopier::copyToString(is, body);

bool fail =; // true
bool bad = is.bad();
bool eof = is.eof(); // true

if (fail)
  // this throws even if all went fine

What is the correct way to check if transfer failed? Is there a way enable POCO exceptions for transfer failures?

Return to “Support”

Who is online

Users browsing this forum: thelifeofapanca and 1 guest