1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Fix: Send final reply to client on HTTP upgrade

Closes: #2356
This commit is contained in:
Philipp Schafft 2018-11-13 08:51:02 +00:00
parent 7637e8f5e3
commit 143a8b717f
3 changed files with 28 additions and 4 deletions

View File

@ -169,8 +169,28 @@ static inline void client_reuseconnection(client_t *client) {
return;
con = client->con;
con = connection_create(con->sock, con->listensocket_real, con->listensocket_effective, strdup(con->ip));
reuse = client->reuse;
if (reuse == ICECAST_REUSE_UPGRADETLS) {
http_parser_t *parser = client->parser;
httpp_deletevar(parser, "upgrade");
client->reuse = ICECAST_REUSE_CLOSE;
/* release the buffer now, as the buffer could be on the source queue
* and may of disappeared after auth completes */
client_set_queue(client, NULL);
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->refbuf->len = 0; /* force reader code to ignore buffer contents */
client->pos = 0;
connection_uses_tls(con);
connection_queue_client(client);
return;
}
con = connection_create(con->sock, con->listensocket_real, con->listensocket_effective, strdup(con->ip));
client->con->sock = -1; /* TODO: do not use magic */
/* handle to keep the TLS connection */
@ -199,9 +219,6 @@ static inline void client_reuseconnection(client_t *client) {
client->reuse = ICECAST_REUSE_CLOSE;
client_destroy(client);
if (reuse == ICECAST_REUSE_UPGRADETLS)
connection_uses_tls(con);
connection_queue(con);
}

View File

@ -1749,3 +1749,9 @@ void connection_close(connection_t *con)
refobject_unref(con->listensocket_effective);
free(con);
}
void connection_queue_client(client_t *client)
{
client_queue_t *node = create_client_node(client);
_add_connection(node);
}

View File

@ -75,6 +75,7 @@ void connection_close(connection_t *con);
connection_t *connection_create(sock_t sock, listensocket_t *listensocket_real, listensocket_t* listensocket_effective, char *ip);
int connection_complete_source(source_t *source, int response);
void connection_queue(connection_t *con);
void connection_queue_client(client_t *client);
void connection_uses_tls(connection_t *con);
ssize_t connection_send_bytes(connection_t *con, const void *buf, size_t len);