From 898cd8f83d56ece9df9f02d54170a96f7cf6d500 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 8 Jun 2018 02:02:13 -0700 Subject: http server: do not close connections after reply Change-Id: I7add46258fe44bc4d23d805ffc7eae75e37cab82 Signed-off-by: Florin Coras --- src/vnet/session-apps/http_server.c | 51 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'src/vnet/session-apps/http_server.c') diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c index 6a2e6cda1a2..9ad1297b901 100644 --- a/src/vnet/session-apps/http_server.c +++ b/src/vnet/session-apps/http_server.c @@ -87,30 +87,37 @@ free_http_process (http_server_args * args) vec_add1 (hsm->free_http_cli_process_node_indices, node_index); } -static const char - *http_response = "HTTP/1.1 200 OK\r\n" - "Content-Type: text/html\r\n" - "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n" - "Connection: close\r\n" - "Pragma: no-cache\r\n" "Content-Length: %d\r\n\r\n%s"; - -static const char - *http_error_template = "HTTP/1.1 %s\r\n" - "Content-Type: text/html\r\n" - "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n" - "Connection: close\r\n" "Pragma: no-cache\r\n" "Content-Length: 0\r\n\r\n"; +/* *INDENT-OFF* */ +static const char *http_response = + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n" + "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n" + "Connection: keep-alive \r\n" + "Pragma: no-cache\r\n" + "Content-Length: %d\r\n\r\n%s"; + +static const char *http_error_template = + "HTTP/1.1 %s\r\n" + "Content-Type: text/html\r\n" + "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n" + "Connection: close\r\n" + "Pragma: no-cache\r\n" + "Content-Length: 0\r\n\r\n"; /* Header, including incantation to suppress favicon.ico requests */ -static const char - *html_header_template = "%v" - "
";
-
-static const char *html_footer = "
\r\n"; - -static const char - *html_header_static = "static reply" - "
hello
" - "\r\n"; +static const char *html_header_template = + "%v" + "" + "
";
+
+static const char *html_footer =
+    "
\r\n"; + +static const char *html_header_static = + "static reply" + "" + "
hello
\r\n"; +/* *INDENT-ON* */ static u8 *static_http; -- cgit 1.2.3-korg