kore

a fork of the worlds most advanced web framework
Log | Files | Refs | README | LICENSE

commit 61b385ae11f0d8148f1aeac3a2e8cb5fbac5ec8b
parent cf2e15877335623ba429c889e724fc16804ba003
Author: Joris Vink <joris@coders.se>
Date:   Fri, 30 Nov 2018 22:12:43 +0100

do not set CONN_CLOSE_EMPTY for 1.0 until we reply.

Diffstat:
Msrc/http.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/http.c b/src/http.c @@ -1394,7 +1394,6 @@ http_request_new(struct connection *c, const char *host, } flags = HTTP_VERSION_1_0; - c->flags |= CONN_CLOSE_EMPTY; } else { flags = HTTP_VERSION_1_1; } @@ -1853,10 +1852,12 @@ http_response_normal(struct http_request *req, struct connection *c, version, status, http_status_text(status)); kore_buf_append(header_buf, http_version, http_version_len); - if (c->flags & CONN_CLOSE_EMPTY) + if ((c->flags & CONN_CLOSE_EMPTY) || + (req->flags & HTTP_VERSION_1_0)) { connection_close = 1; - else + } else { connection_close = 0; + } if (connection_close == 0 && req != NULL) { if (http_request_header(req, "connection", &conn)) {