2020-01-18 08:38:21 +00:00
|
|
|
/*
|
2021-04-28 20:46:44 +00:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2020-01-18 08:38:21 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2019-04-07 12:36:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-04-07 17:35:07 +00:00
|
|
|
#include <AK/HashMap.h>
|
2020-02-06 14:04:03 +00:00
|
|
|
#include <LibCore/NetworkJob.h>
|
2020-04-20 21:25:25 +00:00
|
|
|
#include <LibHTTP/HttpRequest.h>
|
|
|
|
#include <LibHTTP/HttpResponse.h>
|
2020-05-05 05:17:40 +00:00
|
|
|
#include <LibHTTP/Job.h>
|
2020-04-20 21:25:25 +00:00
|
|
|
#include <LibTLS/TLSv12.h>
|
2019-04-07 12:36:10 +00:00
|
|
|
|
2020-04-20 21:25:25 +00:00
|
|
|
namespace HTTP {
|
2019-04-07 12:36:10 +00:00
|
|
|
|
2020-05-05 05:17:40 +00:00
|
|
|
class HttpsJob final : public Job {
|
2020-04-20 21:25:25 +00:00
|
|
|
C_OBJECT(HttpsJob)
|
2019-04-07 12:36:10 +00:00
|
|
|
public:
|
2020-05-05 05:17:40 +00:00
|
|
|
virtual ~HttpsJob() override
|
|
|
|
{
|
|
|
|
}
|
2019-04-07 12:36:10 +00:00
|
|
|
|
2022-02-02 15:51:55 +00:00
|
|
|
bool received_client_certificates() const { return m_received_client_certificates.has_value(); }
|
|
|
|
Vector<TLS::Certificate> take_client_certificates() const { return m_received_client_certificates.release_value(); }
|
2021-09-17 23:18:22 +00:00
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
void set_certificate(ByteString certificate, ByteString key);
|
2019-04-07 12:36:10 +00:00
|
|
|
|
2022-02-02 15:51:55 +00:00
|
|
|
Function<Vector<TLS::Certificate>()> on_certificate_requested;
|
2019-12-10 19:46:33 +00:00
|
|
|
|
2019-04-07 12:36:10 +00:00
|
|
|
private:
|
2023-02-10 00:00:18 +00:00
|
|
|
explicit HttpsJob(HttpRequest&& request, Stream& output_stream)
|
2021-11-28 22:00:52 +00:00
|
|
|
: Job(move(request), output_stream)
|
2021-10-31 22:38:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-02-02 15:51:55 +00:00
|
|
|
mutable Optional<Vector<TLS::Certificate>> m_received_client_certificates;
|
2019-04-07 12:36:10 +00:00
|
|
|
};
|
2020-02-02 11:34:39 +00:00
|
|
|
|
|
|
|
}
|