Commit 18ba804f authored by Mark Andrews's avatar Mark Andrews
Browse files

4188. [bug] Support HTTP/1.0 client properly on the statistics

                        channel. [RT #40261]
parent 161b5249
4188. [bug] Support HTTP/1.0 client properly on the statistics
channel. [RT #40261]
4187. [func] When any RR type implementation doesn't 4187. [func] When any RR type implementation doesn't
implement totext() for the RDATA's wire implement totext() for the RDATA's wire
representation and returns ISC_R_NOTIMPLEMENTED, representation and returns ISC_R_NOTIMPLEMENTED,
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#define HTTPD_CLOSE 0x0001 /* Got a Connection: close header */ #define HTTPD_CLOSE 0x0001 /* Got a Connection: close header */
#define HTTPD_FOUNDHOST 0x0002 /* Got a Host: header */ #define HTTPD_FOUNDHOST 0x0002 /* Got a Host: header */
#define HTTPD_KEEPALIVE 0x0004 /* Got a Connection: Keep-Alive */
/*% http client */ /*% http client */
struct isc_httpd { struct isc_httpd {
...@@ -483,6 +484,13 @@ process_request(isc_httpd_t *httpd, int length) { ...@@ -483,6 +484,13 @@ process_request(isc_httpd_t *httpd, int length) {
if (strstr(s, "Host: ") != NULL) if (strstr(s, "Host: ") != NULL)
httpd->flags |= HTTPD_FOUNDHOST; httpd->flags |= HTTPD_FOUNDHOST;
if (strncmp(httpd->protocol, "HTTP/1.0", 8) == 0) {
if (strcasestr(s, "Connection: Keep-Alive") != NULL)
httpd->flags |= HTTPD_KEEPALIVE;
else
httpd->flags |= HTTPD_CLOSE;
}
/* /*
* Standards compliance hooks here. * Standards compliance hooks here.
*/ */
...@@ -597,7 +605,7 @@ render_404(const char *url, isc_httpdurl_t *urlinfo, ...@@ -597,7 +605,7 @@ render_404(const char *url, isc_httpdurl_t *urlinfo,
const char **mimetype, isc_buffer_t *b, const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) isc_httpdfree_t **freecb, void **freecb_args)
{ {
static char msg[] = "No such URL."; static char msg[] = "No such URL.\r\n";
UNUSED(url); UNUSED(url);
UNUSED(urlinfo); UNUSED(urlinfo);
...@@ -623,7 +631,7 @@ render_500(const char *url, isc_httpdurl_t *urlinfo, ...@@ -623,7 +631,7 @@ render_500(const char *url, isc_httpdurl_t *urlinfo,
const char **mimetype, isc_buffer_t *b, const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args) isc_httpdfree_t **freecb, void **freecb_args)
{ {
static char msg[] = "Internal server failure."; static char msg[] = "Internal server failure.\r\n";
UNUSED(url); UNUSED(url);
UNUSED(urlinfo); UNUSED(urlinfo);
...@@ -726,6 +734,8 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) { ...@@ -726,6 +734,8 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) {
} }
isc_httpd_response(httpd); isc_httpd_response(httpd);
if ((httpd->flags & HTTPD_KEEPALIVE) != 0)
isc_httpd_addheader(httpd, "Connection", "Keep-Alive");
isc_httpd_addheader(httpd, "Content-Type", httpd->mimetype); isc_httpd_addheader(httpd, "Content-Type", httpd->mimetype);
isc_httpd_addheader(httpd, "Date", datebuf); isc_httpd_addheader(httpd, "Date", datebuf);
isc_httpd_addheader(httpd, "Expires", datebuf); isc_httpd_addheader(httpd, "Expires", datebuf);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment