Fix a crash processing TLS while a session is closing.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4715 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
6920504762
commit
797509fc11
28
src/http.c
28
src/http.c
@ -712,7 +712,7 @@ static void _http_tls_update(tf_http_connection_t* connection)
|
|||||||
{
|
{
|
||||||
again = false;
|
again = false;
|
||||||
|
|
||||||
if (connection->is_handshaking)
|
if (connection->is_handshaking && connection->tls)
|
||||||
{
|
{
|
||||||
switch (tf_tls_session_handshake(connection->tls))
|
switch (tf_tls_session_handshake(connection->tls))
|
||||||
{
|
{
|
||||||
@ -727,19 +727,27 @@ static void _http_tls_update(tf_http_connection_t* connection)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[8192];
|
/* Maybe we became disconnected and cleaned up our TLS session. */
|
||||||
int r = tf_tls_session_read_encrypted(connection->tls, buffer, sizeof(buffer));
|
if (connection->tls)
|
||||||
if (r > 0)
|
|
||||||
{
|
{
|
||||||
_http_write_internal(connection, buffer, r);
|
char buffer[8192];
|
||||||
again = true;
|
int r = tf_tls_session_read_encrypted(connection->tls, buffer, sizeof(buffer));
|
||||||
|
if (r > 0)
|
||||||
|
{
|
||||||
|
_http_write_internal(connection, buffer, r);
|
||||||
|
again = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = tf_tls_session_read_plain(connection->tls, buffer, sizeof(buffer));
|
if (connection->tls)
|
||||||
if (r > 0)
|
|
||||||
{
|
{
|
||||||
_http_on_read_plain(connection, buffer, r);
|
char buffer[8192];
|
||||||
again = true;
|
int r = tf_tls_session_read_plain(connection->tls, buffer, sizeof(buffer));
|
||||||
|
if (r > 0)
|
||||||
|
{
|
||||||
|
_http_on_read_plain(connection, buffer, r);
|
||||||
|
again = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user