Add CURLcode and TransferInfo to completed_headers event.
This commit is contained in:
@@ -122,11 +122,14 @@ class AICurlNoBody : public AICurlError {
|
||||
// End Exceptions.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward declaration.
|
||||
namespace AICurlInterface { struct TransferInfo; }
|
||||
|
||||
// Events generated by AICurlPrivate::CurlResponderBuffer.
|
||||
struct AICurlResponderBufferEvents {
|
||||
virtual void received_HTTP_header(void) = 0; // For example "HTTP/1.0 200 OK", the first header of a reply.
|
||||
virtual void received_header(std::string const& key, std::string const& value) = 0; // Subsequent headers.
|
||||
virtual void completed_headers(U32 status, std::string const& reason) = 0; // Transaction completed.
|
||||
virtual void completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info) = 0; // Transaction completed.
|
||||
};
|
||||
|
||||
// Things defined in this namespace are called from elsewhere in the viewer code.
|
||||
@@ -235,7 +238,7 @@ class Responder : public AICurlResponderBufferEvents {
|
||||
}
|
||||
|
||||
// Called when the whole transaction is completed (also the body was received), but before the body is processed.
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason)
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, CURLcode code, TransferInfo* info)
|
||||
{
|
||||
completedHeaders(status, reason, mReceivedHeaders);
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ class CurlResponderBuffer : protected AICurlResponderBufferEvents, protected AIC
|
||||
// Events from this class.
|
||||
/*virtual*/ void received_HTTP_header(void);
|
||||
/*virtual*/ void received_header(std::string const& key, std::string const& value);
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason);
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info);
|
||||
|
||||
// CurlEasyHandle events.
|
||||
/*virtual*/ void added_to_multi_handle(AICurlEasyRequest_wat& curl_easy_request_w);
|
||||
|
||||
@@ -2076,7 +2076,8 @@ void CurlResponderBuffer::processOutput(AICurlEasyRequest_wat& curl_easy_request
|
||||
std::string responseReason;
|
||||
|
||||
CURLcode code;
|
||||
curl_easy_request_w->getResult(&code);
|
||||
AICurlInterface::TransferInfo info;
|
||||
curl_easy_request_w->getResult(&code, &info);
|
||||
if (code == CURLE_OK)
|
||||
{
|
||||
curl_easy_request_w->getinfo(CURLINFO_RESPONSE_CODE, &responseCode);
|
||||
@@ -2107,7 +2108,7 @@ void CurlResponderBuffer::processOutput(AICurlEasyRequest_wat& curl_easy_request
|
||||
llassert(mEventsTarget == mResponder.get());
|
||||
// Allow clients to parse result codes and headers before we attempt to parse
|
||||
// the body and provide completed/result/error calls.
|
||||
mEventsTarget->completed_headers(responseCode, responseReason);
|
||||
mEventsTarget->completed_headers(responseCode, responseReason, code, (code == CURLE_FAILED_INIT) ? NULL : &info);
|
||||
}
|
||||
mResponder->completedRaw(responseCode, responseReason, sChannels, mOutput);
|
||||
mResponder = NULL;
|
||||
@@ -2128,10 +2129,10 @@ void CurlResponderBuffer::received_header(std::string const& key, std::string co
|
||||
mEventsTarget->received_header(key, value);
|
||||
}
|
||||
|
||||
void CurlResponderBuffer::completed_headers(U32 status, std::string const& reason)
|
||||
void CurlResponderBuffer::completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info)
|
||||
{
|
||||
if (mEventsTarget)
|
||||
mEventsTarget->completed_headers(status, reason);
|
||||
mEventsTarget->completed_headers(status, reason, code, info);
|
||||
}
|
||||
|
||||
//static
|
||||
|
||||
Reference in New Issue
Block a user