#define HTTPD_CLOSE 0x0001 /* Got a Connection: close header */
#define HTTPD_FOUNDHOST 0x0002 /* Got a Host: header */
+#define HTTPD_KEEPALIVE 0x0004 /* Got a Connection: Keep-Alive */
/*% http client */
struct isc_httpd {
if (strstr(s, "Host: ") != NULL)
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.
*/
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args)
{
- static char msg[] = "No such URL.";
+ static char msg[] = "No such URL.\r\n";
UNUSED(url);
UNUSED(urlinfo);
const char **mimetype, isc_buffer_t *b,
isc_httpdfree_t **freecb, void **freecb_args)
{
- static char msg[] = "Internal server failure.";
+ static char msg[] = "Internal server failure.\r\n";
UNUSED(url);
UNUSED(urlinfo);
}
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, "Date", datebuf);
isc_httpd_addheader(httpd, "Expires", datebuf);