Commit 143a8b71 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Fix: Send final reply to client on HTTP upgrade

Closes: #2356
parent 7637e8f5
......@@ -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);
}
......
......@@ -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);
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment