mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibWeb: Fix redirects when a response has no data
This makes redirects work when the HTTP server responds with just headers and no data.
This commit is contained in:
parent
e9388408db
commit
12f3aa9faa
Notes:
sideshowbarker
2024-07-18 11:58:18 +09:00
Author: https://github.com/gil0mendes 🔰
Commit: 12f3aa9faa
Pull-request: https://github.com/SerenityOS/serenity/pull/8166
1 changed files with 5 additions and 5 deletions
|
@ -229,11 +229,6 @@ void FrameLoader::resource_did_load()
|
||||||
{
|
{
|
||||||
auto url = resource()->url();
|
auto url = resource()->url();
|
||||||
|
|
||||||
if (!resource()->has_encoded_data()) {
|
|
||||||
load_error_page(url, "No data");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Also check HTTP status code before redirecting
|
// FIXME: Also check HTTP status code before redirecting
|
||||||
auto location = resource()->response_headers().get("Location");
|
auto location = resource()->response_headers().get("Location");
|
||||||
if (location.has_value()) {
|
if (location.has_value()) {
|
||||||
|
@ -248,6 +243,11 @@ void FrameLoader::resource_did_load()
|
||||||
}
|
}
|
||||||
m_redirects_count = 0;
|
m_redirects_count = 0;
|
||||||
|
|
||||||
|
if (!resource()->has_encoded_data()) {
|
||||||
|
load_error_page(url, "No data");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (resource()->has_encoding()) {
|
if (resource()->has_encoding()) {
|
||||||
dbgln("This content has MIME type '{}', encoding '{}'", resource()->mime_type(), resource()->encoding().value());
|
dbgln("This content has MIME type '{}', encoding '{}'", resource()->mime_type(), resource()->encoding().value());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue