kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 64156707536cb11e2fca8abece1e0173af3214ee
parent 8e359ede132710c6545782fd9036e89001aba4e1
Author: Joris Vink <joris@coders.se>
Date:   Tue,  4 Jul 2017 10:55:11 +0200

set CONN_CLOSE_EMPTY for early HTTP errors.

while here fix missing connection response headers for errors.

Diffstat:
src/http.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c @@ -1601,6 +1601,8 @@ http_error_response(struct connection *c, int status) { kore_debug("http_error_response(%p, %d)", c, status); + c->flags |= CONN_CLOSE_EMPTY; + switch (c->proto) { case CONN_PROTO_HTTP: http_response_normal(NULL, c, status, NULL, 0); @@ -1643,7 +1645,7 @@ http_response_normal(struct http_request *req, struct connection *c, } /* Note that req CAN be NULL. */ - if (req != NULL && req->owner->proto != CONN_PROTO_WEBSOCKET) { + if (req == NULL || req->owner->proto != CONN_PROTO_WEBSOCKET) { if (http_keepalive_time && connection_close == 0) { kore_buf_appendf(header_buf, "connection: keep-alive\r\n");