mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
LibWeb: Add basic support for redirects
This commit is contained in:
parent
e09b83c60c
commit
94c28552c6
1 changed files with 8 additions and 1 deletions
|
@ -27,11 +27,11 @@
|
||||||
#include <AK/FileSystemPath.h>
|
#include <AK/FileSystemPath.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibGfx/ImageDecoder.h>
|
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/ScrollBar.h>
|
#include <LibGUI/ScrollBar.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
|
#include <LibGfx/ImageDecoder.h>
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibWeb/DOM/Element.h>
|
#include <LibWeb/DOM/Element.h>
|
||||||
#include <LibWeb/DOM/ElementFactory.h>
|
#include <LibWeb/DOM/ElementFactory.h>
|
||||||
|
@ -370,6 +370,13 @@ void HtmlView::load(const URL& url)
|
||||||
ResourceLoader::the().load(
|
ResourceLoader::the().load(
|
||||||
url,
|
url,
|
||||||
[this, url](auto data, auto& response_headers) {
|
[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()) {
|
if (data.is_null()) {
|
||||||
load_error_page(url, "No data");
|
load_error_page(url, "No data");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue