1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 18:05:08 +00:00

ProtocolServer: Pass HTTP response headers to the client

We now store the response headers in a download object on the protocol
server side and pass it to the client when finishing up a download.

Response headers are passed as an IPC::Dictionary. :^)
This commit is contained in:
Andreas Kling 2020-05-03 22:20:49 +02:00
parent a83d74b38c
commit eb6e35a1be
18 changed files with 49 additions and 30 deletions

View file

@ -360,7 +360,7 @@ void HtmlView::load(const URL& url)
ResourceLoader::the().load(
url,
[this, url](auto data) {
[this, url](auto data, auto& response_headers) {
if (data.is_null()) {
load_error_page(url, "No data");
return;
@ -390,7 +390,7 @@ void HtmlView::load(const URL& url)
ResourceLoader::the().load(
favicon_url,
[this, favicon_url](auto data) {
[this, favicon_url](auto data, auto&) {
dbg() << "Favicon downloaded, " << data.size() << " bytes from " << favicon_url.to_string();
auto decoder = Gfx::ImageDecoder::create(data.data(), data.size());
auto bitmap = decoder->bitmap();
@ -412,7 +412,7 @@ void HtmlView::load_error_page(const URL& failed_url, const String& error)
auto error_page_url = "file:///res/html/error.html";
ResourceLoader::the().load(
error_page_url,
[this, failed_url, error](auto data) {
[this, failed_url, error](auto data, auto&) {
ASSERT(!data.is_null());
auto html = String::format(
String::copy(data).characters(),