Skip to content

Commit 3381a70

Browse files
committed
FIX | proxy bug #3
1 parent 0960fb9 commit 3381a70

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/services/ManapiFetch.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ static manapi::future<bool> handle_body_verify (std::shared_ptr<manapi::net::fet
439439
"curl_easy_getinfo with CURLINFO_HTTP_CODE", curl_easy_strerror(res));
440440
}
441441

442+
if (!data->status_code_)
443+
data->status_code_ = 500;
444+
442445
try {
443446
if (data->async_handler_headers) {
444447
auto const cb = std::move(data->async_handler_headers);
@@ -830,6 +833,17 @@ manapi::future<manapi::error::status> manapi::net::fetch::async_doit() {
830833
}
831834

832835
if (this->data->headers && !this->data->headers->empty()) {
836+
if (!this->data->status_code_) {
837+
auto res = curl_easy_getinfo(this->data->curl.get(), CURLINFO_HTTP_CODE, &this->data->status_code_);
838+
if (res) {
839+
manapi_log_trace(manapi::debug::LOG_TRACE_MEDIUM, "%s:%s failed due to %s", "fetch",
840+
"curl_easy_getinfo with CURLINFO_HTTP_CODE", curl_easy_strerror(res));
841+
}
842+
843+
if (!this->data->status_code_)
844+
this->data->status_code_ = 500;
845+
}
846+
833847
if (this->data->async_handler_headers) {
834848
co_await this->data->async_handler_headers->operator()(std::move(*this->data->headers));
835849
}

0 commit comments

Comments
 (0)