mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
RequestServer: Do not crash on Gemini responses
Starting a gemini request creates a pipe for the output stream for the response, and a Core::Stream::File object is created from that pipe. Previously, the length of the response was computed by calling output_stream.size() which used lseek on the file descriptor. Doing that returned an error from lseek. Computing the value by counting the received bytes (via Gemini::Job::response_length) avoids that crash.
This commit is contained in:
parent
0245a62f81
commit
f883dc3eb0
Notes:
sideshowbarker
2024-07-17 01:44:01 +09:00
Author: https://github.com/kuzux Commit: https://github.com/SerenityOS/serenity/commit/f883dc3eb0 Pull-request: https://github.com/SerenityOS/serenity/pull/16996 Reviewed-by: https://github.com/alimpfard
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ GeminiRequest::GeminiRequest(ConnectionFromClient& client, NonnullRefPtr<Gemini:
|
|||
ConnectionCache::request_did_finish(url, socket);
|
||||
});
|
||||
if (auto* response = m_job->response()) {
|
||||
set_downloaded_size(MUST(const_cast<Core::Stream::File&>(this->output_stream()).size()));
|
||||
set_downloaded_size(MUST(m_job->response_length()));
|
||||
if (!response->meta().is_empty()) {
|
||||
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> headers;
|
||||
headers.set("meta", response->meta());
|
||||
|
|
Loading…
Reference in a new issue