diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-03 22:58:33 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-04 00:01:31 +0200 |
commit | 94c28552c6e29cebd83bf48084262c1003f7baab (patch) | |
tree | 81f837ae2bfad12f76f509f73907a7d7bc77e737 /Libraries | |
parent | e09b83c60c77bef5fc7704dfe6f70df75462b62f (diff) | |
download | serenity-94c28552c6e29cebd83bf48084262c1003f7baab.zip |
LibWeb: Add basic support for redirects
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/HtmlView.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp index 0a1cb337ad..63753203c5 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/Libraries/LibWeb/HtmlView.cpp @@ -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; |