kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit be3fa17201a3e37d877c6690082907c4346ff804
parent a4e462b36cb230fd68735a42d5f2a3d3cf9f67b3
Author: Joris Vink <joris@coders.se>
Date:   Tue, 30 Jun 2015 16:43:21 +0200

Do not send connection:close for websocket upgrades.

Diffstat:
src/http.c | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/http.c b/src/http.c @@ -1247,15 +1247,16 @@ http_response_normal(struct http_request *req, struct connection *c, } } - if (http_keepalive_time && connection_close == 0) { - if (req->owner->proto != CONN_PROTO_WEBSOCKET) { - kore_buf_appendf(header_buf, "connection: keep-alive\r\n"); - kore_buf_appendf(header_buf, "keep-alive: timeout=%d\r\n", - http_keepalive_time); + if (req->owner->proto != CONN_PROTO_WEBSOCKET) { + if (http_keepalive_time && connection_close == 0) { + kore_buf_appendf(header_buf, + "connection: keep-alive\r\n"); + kore_buf_appendf(header_buf, + "keep-alive: timeout=%d\r\n", http_keepalive_time); + } else { + c->flags |= CONN_CLOSE_EMPTY; + kore_buf_appendf(header_buf, "connection: close\r\n"); } - } else { - c->flags |= CONN_CLOSE_EMPTY; - kore_buf_appendf(header_buf, "connection: close\r\n"); } if (http_hsts_enable) {