diff options
author | Andreas Kling <kling@serenityos.org> | 2023-02-24 15:12:32 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-24 19:15:49 +0100 |
commit | 137972074277f0e782728d98267970dd5247cab1 (patch) | |
tree | a56279f66a5582f98a14d737ca1dee1ee2d323fe | |
parent | 3435820e1f18ded9b95d503a4ed41a21c8ada0b8 (diff) | |
download | serenity-137972074277f0e782728d98267970dd5247cab1.zip |
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.
-rw-r--r-- | Ladybird/RequestManagerQt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Ladybird/RequestManagerQt.cpp b/Ladybird/RequestManagerQt.cpp index c5a1bc3e11..81b9640f41 100644 --- a/Ladybird/RequestManagerQt.cpp +++ b/Ladybird/RequestManagerQt.cpp @@ -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() }); } |