diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2011-09-15 19:04:25 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2011-09-15 19:04:25 +0000 |
commit | 05552a23a23cf725afeda19d0282d2a5797897fd (patch) | |
tree | 49863385cfd5d82ec5e1ee8cd66b5c05f352281d /src/http/modules/ngx_http_memcached_module.c | |
parent | 2d6be3fe93201552439c48b7f90744746b18a233 (diff) | |
download | nginx-05552a23a23cf725afeda19d0282d2a5797897fd.tar.gz nginx-05552a23a23cf725afeda19d0282d2a5797897fd.zip |
Keepalive support in memcached.
Diffstat (limited to 'src/http/modules/ngx_http_memcached_module.c')
-rw-r--r-- | src/http/modules/ngx_http_memcached_module.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c index cdc586964..dbe0fe838 100644 --- a/src/http/modules/ngx_http_memcached_module.c +++ b/src/http/modules/ngx_http_memcached_module.c @@ -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; } |