mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
649d2faeab
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).
40 lines
750 B
C++
40 lines
750 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/StringBuilder.h>
|
|
#include <AK/URL.h>
|
|
#include <LibGemini/GeminiJob.h>
|
|
#include <LibGemini/GeminiRequest.h>
|
|
|
|
namespace Gemini {
|
|
|
|
GeminiRequest::GeminiRequest()
|
|
{
|
|
}
|
|
|
|
GeminiRequest::~GeminiRequest()
|
|
{
|
|
}
|
|
|
|
ByteBuffer GeminiRequest::to_raw_request() const
|
|
{
|
|
StringBuilder builder;
|
|
builder.append(m_url.to_string());
|
|
builder.append("\r\n");
|
|
return builder.to_byte_buffer();
|
|
}
|
|
|
|
Optional<GeminiRequest> GeminiRequest::from_raw_request(const ByteBuffer& raw_request)
|
|
{
|
|
URL url = StringView(raw_request);
|
|
if (!url.is_valid())
|
|
return {};
|
|
GeminiRequest request;
|
|
request.m_url = url;
|
|
return request;
|
|
}
|
|
|
|
}
|