mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
LibWeb: Add basic support for redirects
This commit is contained in:
parent
e09b83c60c
commit
94c28552c6
Notes:
sideshowbarker
2024-07-19 07:00:21 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/94c28552c6e Pull-request: https://github.com/SerenityOS/serenity/pull/2089
1 changed files with 8 additions and 1 deletions
|
@ -27,11 +27,11 @@
|
|||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ScrollBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/ImageDecoder.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
|
@ -370,6 +370,13 @@ void HtmlView::load(const URL& url)
|
|||
ResourceLoader::the().load(
|
||||
url,
|
||||
[this, url](auto data, auto& response_headers) {
|
||||
// FIXME: Also check HTTP status code before redirecting
|
||||
auto location = response_headers.get("Location");
|
||||
if (location.has_value()) {
|
||||
load(location.value());
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.is_null()) {
|
||||
load_error_page(url, "No data");
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue