2021-04-23 22:45:52 +02:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2021-04-23 22:45:52 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibHTTP/HttpsJob.h>
|
|
|
|
#include <RequestServer/HttpCommon.h>
|
|
|
|
#include <RequestServer/HttpsProtocol.h>
|
|
|
|
#include <RequestServer/HttpsRequest.h>
|
|
|
|
|
|
|
|
namespace RequestServer {
|
|
|
|
|
2024-02-24 14:36:57 +01:00
|
|
|
HttpsRequest::HttpsRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::File>&& output_stream, i32 request_id)
|
|
|
|
: Request(client, move(output_stream), request_id)
|
2021-04-23 22:45:52 +02:00
|
|
|
, m_job(job)
|
|
|
|
{
|
|
|
|
Detail::init(this, job);
|
|
|
|
}
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
void HttpsRequest::set_certificate(ByteString certificate, ByteString key)
|
2021-04-23 22:45:52 +02:00
|
|
|
{
|
|
|
|
m_job->set_certificate(move(certificate), move(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
HttpsRequest::~HttpsRequest()
|
|
|
|
{
|
|
|
|
m_job->on_finish = nullptr;
|
|
|
|
m_job->on_progress = nullptr;
|
2021-09-19 18:18:19 +04:30
|
|
|
m_job->cancel();
|
2021-04-23 22:45:52 +02:00
|
|
|
}
|
|
|
|
|
2024-02-24 14:36:57 +01:00
|
|
|
NonnullOwnPtr<HttpsRequest> HttpsRequest::create_with_job(Badge<HttpsProtocol>&&, ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::File>&& output_stream, i32 request_id)
|
2021-04-23 22:45:52 +02:00
|
|
|
{
|
2024-02-24 14:36:57 +01:00
|
|
|
return adopt_own(*new HttpsRequest(client, move(job), move(output_stream), request_id));
|
2021-04-23 22:45:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|