introduce is connection close

svn:r260
This commit is contained in:
Niels Provos 2006-11-18 02:10:25 +00:00
parent a67d9cb115
commit d2c27da114

12
http.c
View File

@ -1125,6 +1125,13 @@ evhttp_start_read(struct evhttp_connection *evcon)
event_add(&evcon->ev, &tv); event_add(&evcon->ev, &tv);
} }
static int
evhttp_is_connection_close(struct evkeyval* headers)
{
const char *connection = evhttp_find_header(headers, "Connection");
return (connection != NULL && strcasecmp(connection, "close") == 0);
}
void void
evhttp_send_done(struct evhttp_connection *evcon, void *arg) evhttp_send_done(struct evhttp_connection *evcon, void *arg)
{ {
@ -1132,9 +1139,8 @@ evhttp_send_done(struct evhttp_connection *evcon, void *arg)
TAILQ_REMOVE(&evcon->requests, req, next); TAILQ_REMOVE(&evcon->requests, req, next);
if (req->flags & EVHTTP_REQ_OWN_CONNECTION) { if (req->flags & EVHTTP_REQ_OWN_CONNECTION) {
const char *connection = if (!evhttp_is_connection_close(req->input_headers) &&
evhttp_find_header(req->output_headers, "Connection"); !evhttp_is_connection_close(req->output_headers)) {
if (connection == NULL || strcasecmp(connection, "close")) {
event_warnx("%s: persistent connection not supported", event_warnx("%s: persistent connection not supported",
__func__); __func__);
} }