2021-04-23 20:45:52 +00:00
|
|
|
/*
|
2024-10-04 11:19:50 +00:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2021-04-23 20:45:52 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-02-25 10:18:30 +00:00
|
|
|
#include <RequestServer/ConnectionFromClient.h>
|
2021-04-23 20:45:52 +00:00
|
|
|
#include <RequestServer/Request.h>
|
|
|
|
|
|
|
|
namespace RequestServer {
|
|
|
|
|
2024-02-24 13:36:57 +00:00
|
|
|
Request::Request(ConnectionFromClient& client, NonnullOwnPtr<Core::File>&& output_stream, i32 request_id)
|
2021-04-23 20:45:52 +00:00
|
|
|
: m_client(client)
|
2024-02-24 13:36:57 +00:00
|
|
|
, m_id(request_id)
|
2021-04-23 20:45:52 +00:00
|
|
|
, m_output_stream(move(output_stream))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Request::stop()
|
|
|
|
{
|
|
|
|
m_client.did_finish_request({}, *this, false);
|
|
|
|
}
|
|
|
|
|
2024-06-09 09:28:37 +00:00
|
|
|
void Request::set_response_headers(HTTP::HeaderMap response_headers)
|
2021-04-23 20:45:52 +00:00
|
|
|
{
|
2024-06-09 09:28:37 +00:00
|
|
|
m_response_headers = move(response_headers);
|
2021-04-23 20:45:52 +00:00
|
|
|
m_client.did_receive_headers({}, *this);
|
|
|
|
}
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
void Request::set_certificate(ByteString, ByteString)
|
2021-04-23 20:45:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Request::did_finish(bool success)
|
|
|
|
{
|
|
|
|
m_client.did_finish_request({}, *this, success);
|
|
|
|
}
|
|
|
|
|
2023-06-10 23:56:35 +00:00
|
|
|
void Request::did_progress(Optional<u64> total_size, u64 downloaded_size)
|
2021-04-23 20:45:52 +00:00
|
|
|
{
|
|
|
|
m_total_size = total_size;
|
|
|
|
m_downloaded_size = downloaded_size;
|
|
|
|
m_client.did_progress_request({}, *this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Request::did_request_certificates()
|
|
|
|
{
|
|
|
|
m_client.did_request_certificates({}, *this);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|