mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibHTTP: Relax the finish_up() "must be called once" limitation a bit
It's alright for this function to be called multiple times, as it quits early when a partial flush doesn't empty the download buffer. Relax the assertion to having scheduled "did_finish()" only once.
This commit is contained in:
parent
b12e5de047
commit
3058ff1500
Notes:
sideshowbarker
2024-07-18 11:22:09 +09:00
Author: https://github.com/alimpfard
Commit: 3058ff1500
Pull-request: https://github.com/SerenityOS/serenity/pull/8303
2 changed files with 5 additions and 3 deletions
|
@ -360,7 +360,7 @@ void Job::timer_event(Core::TimerEvent& event)
|
|||
|
||||
void Job::finish_up()
|
||||
{
|
||||
VERIFY(m_state != State::Finished);
|
||||
VERIFY(!m_has_scheduled_finish);
|
||||
m_state = State::Finished;
|
||||
if (!m_can_stream_response) {
|
||||
auto flattened_buffer = ByteBuffer::create_uninitialized(m_received_size);
|
||||
|
@ -395,9 +395,10 @@ void Job::finish_up()
|
|||
return;
|
||||
}
|
||||
|
||||
m_has_scheduled_finish = true;
|
||||
auto response = HttpResponse::create(m_code, move(m_headers));
|
||||
deferred_invoke([this, response](auto&) {
|
||||
did_finish(move(response));
|
||||
deferred_invoke([this, response = move(response)](auto&) {
|
||||
did_finish(response);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue