diff options
author | Linus Groh <mail@linusgroh.de> | 2023-03-09 14:51:48 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-09 14:51:48 +0000 |
commit | 077f7d1577ffb31fac9dd996e984dff9f76c8341 (patch) | |
tree | 29225d93ee722e7075409534d1c7c7f1af512ead /Userland/Libraries/LibGemini | |
parent | d0ecd818889da9bee9096967e9e37fd813a6f9b1 (diff) | |
download | serenity-077f7d1577ffb31fac9dd996e984dff9f76c8341.zip |
LibGemini: Propagate OOM errors from GeminiRequest::to_raw_request()
Diffstat (limited to 'Userland/Libraries/LibGemini')
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiRequest.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiRequest.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/Job.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGemini/GeminiRequest.cpp b/Userland/Libraries/LibGemini/GeminiRequest.cpp index ef395771ac..14287b390f 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.cpp +++ b/Userland/Libraries/LibGemini/GeminiRequest.cpp @@ -10,12 +10,12 @@ namespace Gemini { -ByteBuffer GeminiRequest::to_raw_request() const +ErrorOr<ByteBuffer> GeminiRequest::to_raw_request() const { StringBuilder builder; - builder.append(m_url.to_deprecated_string()); - builder.append("\r\n"sv); - return builder.to_byte_buffer(); + TRY(builder.try_append(m_url.to_deprecated_string())); + TRY(builder.try_append("\r\n"sv)); + return builder.try_to_byte_buffer(); } Optional<GeminiRequest> GeminiRequest::from_raw_request(ByteBuffer const& raw_request) diff --git a/Userland/Libraries/LibGemini/GeminiRequest.h b/Userland/Libraries/LibGemini/GeminiRequest.h index 56df2bb78f..97ff92989b 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.h +++ b/Userland/Libraries/LibGemini/GeminiRequest.h @@ -21,7 +21,7 @@ public: const URL& url() const { return m_url; } void set_url(const URL& url) { m_url = url; } - ByteBuffer to_raw_request() const; + ErrorOr<ByteBuffer> to_raw_request() const; static Optional<GeminiRequest> from_raw_request(ByteBuffer const&); diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index b7937c6af6..a7cde0a21f 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -111,7 +111,7 @@ void Job::flush_received_buffers() void Job::on_socket_connected() { - auto raw_request = m_request.to_raw_request(); + auto raw_request = m_request.to_raw_request().release_value_but_fixme_should_propagate_errors(); if constexpr (JOB_DEBUG) { dbgln("Job: raw_request:"); |