Keepalive support in memcached.

This commit is contained in:
Maxim Dounin 2011-09-15 19:04:25 +00:00
parent 2d6be3fe93
commit 05552a23a2

View File

@ -366,6 +366,7 @@ found:
u->headers_in.status_n = 404;
u->state->status = 404;
u->keepalive = 1;
return NGX_OK;
}
@ -426,6 +427,10 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
u->length -= bytes;
ctx->rest -= bytes;
if (u->length == 0) {
u->keepalive = 1;
}
return NGX_OK;
}
@ -463,6 +468,13 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) {
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
"memcached sent invalid trailer");
b->last = last;
cl->buf->last = last;
u->length = 0;
ctx->rest = 0;
return NGX_OK;
}
ctx->rest -= b->last - last;
@ -470,6 +482,10 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
cl->buf->last = last;
u->length = ctx->rest;
if (u->length == 0) {
u->keepalive = 1;
}
return NGX_OK;
}