blob: 37c5798ab429263f5d8dd255f16346dda71538a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* Copyright (c) 2020-2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/StringBuilder.h>
#include <AK/URL.h>
#include <LibGemini/GeminiRequest.h>
namespace Gemini {
ByteBuffer GeminiRequest::to_raw_request() const
{
StringBuilder builder;
builder.append(m_url.to_string());
builder.append("\r\n"sv);
return builder.to_byte_buffer();
}
Optional<GeminiRequest> GeminiRequest::from_raw_request(ByteBuffer const& raw_request)
{
URL url = StringView(raw_request);
if (!url.is_valid())
return {};
GeminiRequest request;
request.m_url = url;
return request;
}
}
|