diff options
author | Andreas Kling <kling@serenityos.org> | 2023-02-24 15:00:56 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-24 19:15:49 +0100 |
commit | 3435820e1f18ded9b95d503a4ed41a21c8ada0b8 (patch) | |
tree | 730c78226d264dcb591856caf8ad99af30fef6c3 | |
parent | 47f5a3ea9afeaade0295022c7e01fdc54401ef9f (diff) | |
download | serenity-3435820e1f18ded9b95d503a4ed41a21c8ada0b8.zip |
LibWeb: Render HTML content if present for HTTP error pages
If an HTTP response fails with an error code (e.g 403) but still has
body content, we now render the content.
We only fall back to our own built-in error page if there's no body.
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp index 0e2b4876da..bfa95459fd 100644 --- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp @@ -322,7 +322,7 @@ void ResourceLoader::load(LoadRequest& request, Function<void(ReadonlyBytes, Has store_response_cookies(request.page().value(), request.url(), *set_cookie); } - if (!success || (status_code.has_value() && *status_code >= 400 && *status_code <= 599)) { + if (!success || (status_code.has_value() && *status_code >= 400 && *status_code <= 599 && payload.is_empty())) { StringBuilder error_builder; if (status_code.has_value()) error_builder.appendff("Load failed: {}", *status_code); |