mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibHTTP+LibTLS: Better HTTPS Socket EOF detection
When the server doesn't signal the Content-Length or use a chunked mode, it may just terminate the connection after sending the data. The TLS sockets would then get stuck in a state with no data to read and not reach the disconnected state, making some requests hang. We know double check the EOF status of HTTP jobs after reading the payload to resolve requests properly and also mark the TLS sockets as EOF after processing all the data and the underlying TCP socket reaches EOF. Fixes #12866.
This commit is contained in:
parent
29f91ceeed
commit
e165ae5b60
2 changed files with 9 additions and 1 deletions
|
@ -504,6 +504,14 @@ void Job::on_socket_connected()
|
|||
break;
|
||||
}
|
||||
|
||||
// Check after reading all the buffered data if we have reached the end of stream
|
||||
// for cases where the server didn't send a content length, chunked encoding but is
|
||||
// directly closing the connection.
|
||||
if (!m_content_length.has_value() && !m_current_chunk_remaining_size.has_value() && m_socket->is_eof()) {
|
||||
finish_up();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_current_chunk_remaining_size.has_value()) {
|
||||
auto size = m_current_chunk_remaining_size.value() - payload.size();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue