mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
two commits those go together by mistake
*) fix gzip broken in r1544 *) fix memcached END test
This commit is contained in:
parent
a8afe406ce
commit
fa928a6c66
@ -279,7 +279,9 @@ ngx_http_gzip_header_filter(ngx_http_request_t *r)
|
|||||||
|| r->headers_in.accept_encoding == NULL
|
|| r->headers_in.accept_encoding == NULL
|
||||||
|| (r->headers_out.content_length_n != -1
|
|| (r->headers_out.content_length_n != -1
|
||||||
&& r->headers_out.content_length_n < conf->min_length)
|
&& r->headers_out.content_length_n < conf->min_length)
|
||||||
|| ngx_strcasestrn(r->headers_in.accept_encoding->value.data, "gzip", 3)
|
|| ngx_strcasestrn(r->headers_in.accept_encoding->value.data,
|
||||||
|
"gzip", 4 - 1)
|
||||||
|
== NULL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ngx_http_next_header_filter(r);
|
return ngx_http_next_header_filter(r);
|
||||||
|
@ -426,15 +426,15 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
|
|||||||
|
|
||||||
if (ngx_strncmp(b->last,
|
if (ngx_strncmp(b->last,
|
||||||
ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
|
ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
|
||||||
bytes)
|
ctx->rest)
|
||||||
!= 0)
|
!= 0)
|
||||||
{
|
{
|
||||||
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
||||||
"memcached sent invalid trailer");
|
"memcached sent invalid trailer");
|
||||||
}
|
}
|
||||||
|
|
||||||
u->length -= bytes;
|
u->length = 0;
|
||||||
ctx->rest -= bytes;
|
ctx->rest = 0;
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@ -453,7 +453,8 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
|
|||||||
|
|
||||||
*ll = cl;
|
*ll = cl;
|
||||||
|
|
||||||
cl->buf->pos = b->last;
|
last = b->last;
|
||||||
|
cl->buf->pos = last;
|
||||||
b->last += bytes;
|
b->last += bytes;
|
||||||
cl->buf->last = b->last;
|
cl->buf->last = b->last;
|
||||||
|
|
||||||
@ -461,20 +462,19 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
|
|||||||
"memcached filter bytes:%z size:%z length:%z rest:%z",
|
"memcached filter bytes:%z size:%z length:%z rest:%z",
|
||||||
bytes, b->last - b->pos, u->length, ctx->rest);
|
bytes, b->last - b->pos, u->length, ctx->rest);
|
||||||
|
|
||||||
if (b->last - b->pos <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) {
|
if (bytes <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) {
|
||||||
u->length -= bytes;
|
u->length -= bytes;
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
last += u->length - NGX_HTTP_MEMCACHED_END;
|
||||||
last = b->pos + u->length - NGX_HTTP_MEMCACHED_END;
|
|
||||||
|
|
||||||
if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) {
|
if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) {
|
||||||
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
|
||||||
"memcached sent invalid trailer");
|
"memcached sent invalid trailer");
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->rest = u->length - (b->last - b->pos);
|
ctx->rest -= b->last - last;
|
||||||
b->last = last;
|
b->last = last;
|
||||||
cl->buf->last = last;
|
cl->buf->last = last;
|
||||||
u->length = ctx->rest;
|
u->length = ctx->rest;
|
||||||
|
Loading…
Reference in New Issue
Block a user