mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 04:50:29 +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
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1379720742 Pull-request: https://github.com/SerenityOS/serenity/pull/17597
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…
Reference in a new issue