Merge pull request #7940 from tweag/fix-http-errors-encoding

Log the decompressed body in case of http errors
This commit is contained in:
Eelco Dolstra 2023-03-02 16:25:09 +01:00 committed by GitHub
commit 687d86f8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,10 @@ struct curlFileTransfer : public FileTransfer
{request.uri}, request.parentAct) {request.uri}, request.parentAct)
, callback(std::move(callback)) , callback(std::move(callback))
, finalSink([this](std::string_view data) { , finalSink([this](std::string_view data) {
if (errorSink) {
(*errorSink)(data);
}
if (this->request.dataCallback) { if (this->request.dataCallback) {
auto httpStatus = getHTTPStatus(); auto httpStatus = getHTTPStatus();
@ -163,8 +167,6 @@ struct curlFileTransfer : public FileTransfer
} }
} }
if (errorSink)
(*errorSink)({(char *) contents, realSize});
(*decompressionSink)({(char *) contents, realSize}); (*decompressionSink)({(char *) contents, realSize});
return realSize; return realSize;