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 c22eebb6d958350f52be19d2c13cabf678660815
parent 9a9faa0d87fc8f9e05649cfd6e5f3f0aa596531c
Author: Joris Vink <joris@coders.se>
Date:   Sat, 22 Jun 2013 20:14:10 +0200

for non spdy clients, attempt to keep the connection open as long as possible (aka, send connection: keep-alive and do not close it till client does).

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

diff --git a/src/http.c b/src/http.c @@ -233,7 +233,7 @@ http_response(struct http_request *req, int status, u_int8_t *d, u_int32_t len) kore_buf_appendf(buf, "HTTP/1.1 %d\r\n", status); kore_buf_appendf(buf, "Content-length: %d\r\n", len); - kore_buf_appendf(buf, "Connection: close\r\n"); + kore_buf_appendf(buf, "Connection: keep-alive\r\n"); TAILQ_FOREACH(hdr, &(req->resp_headers), list) { kore_buf_appendf(buf, "%s: %s\r\n", @@ -501,6 +501,10 @@ http_post_data_recv(struct netbuf *nb) static int http_send_done(struct netbuf *nb) { - /* disconnects. */ - return (KORE_RESULT_ERROR); + struct connection *c = (struct connection *)nb->owner; + + net_recv_queue(c, HTTP_HEADER_MAX_LEN, + NETBUF_CALL_CB_ALWAYS, NULL, http_header_recv); + + return (KORE_RESULT_OK); }