mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
Ladybird: Consider HTTP response a success if it has a status code
The QNetworkReply::NetworkError enum mixes all kinds of errors into one enum, HTTP errors, network errors, proxy errors, etc. Instead of caring about it, we now say that HTTP requests were successful if their response has any HTTP status code attached. This allows LibWeb to display error pages when using Qt networking.
This commit is contained in:
parent
3435820e1f
commit
1379720742
1 changed files with 1 additions and 1 deletions
|
@ -84,7 +84,6 @@ RequestManagerQt::Request::~Request() = default;
|
|||
|
||||
void RequestManagerQt::Request::did_finish()
|
||||
{
|
||||
bool success = m_reply.error() == QNetworkReply::NetworkError::NoError;
|
||||
auto buffer = m_reply.readAll();
|
||||
auto http_status_code = m_reply.attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt();
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
|
||||
|
@ -106,5 +105,6 @@ void RequestManagerQt::Request::did_finish()
|
|||
if (!set_cookie_headers.is_empty()) {
|
||||
response_headers.set("set-cookie"sv, JsonArray { set_cookie_headers }.to_deprecated_string());
|
||||
}
|
||||
bool success = http_status_code != 0;
|
||||
on_buffered_request_finish(success, buffer.length(), response_headers, http_status_code, ReadonlyBytes { buffer.data(), (size_t)buffer.size() });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue