Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_memcached_module.c @ 640:eb208e0cf44d NGINX_1_1_4
nginx 1.1.4
*) Feature: the ngx_http_upstream_keepalive module.
*) Feature: the "proxy_http_version" directive.
*) Feature: the "fastcgi_keep_conn" directive.
*) Feature: the "worker_aio_requests" directive.
*) Bugfix: if nginx was built --with-file-aio it could not be run on
Linux kernel which did not support AIO.
*) Bugfix: in Linux AIO error processing.
Thanks to Hagai Avrahami.
*) Bugfix: reduced memory consumption for long-lived requests.
*) Bugfix: the module ngx_http_mp4_module did not support 64-bit MP4
"co64" atom.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 20 Sep 2011 00:00:00 +0400 |
parents | ff463db0be31 |
children | d0f7a625f27c |
comparison
equal
deleted
inserted
replaced
639:b516b4e38bc9 | 640:eb208e0cf44d |
---|---|
342 | 342 |
343 len = p; | 343 len = p; |
344 | 344 |
345 while (*p && *p++ != CR) { /* void */ } | 345 while (*p && *p++ != CR) { /* void */ } |
346 | 346 |
347 r->headers_out.content_length_n = ngx_atoof(len, p - len - 1); | 347 u->headers_in.content_length_n = ngx_atoof(len, p - len - 1); |
348 if (r->headers_out.content_length_n == -1) { | 348 if (u->headers_in.content_length_n == -1) { |
349 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 349 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
350 "memcached sent invalid length in response \"%V\" " | 350 "memcached sent invalid length in response \"%V\" " |
351 "for key \"%V\"", | 351 "for key \"%V\"", |
352 &line, &ctx->key); | 352 &line, &ctx->key); |
353 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | 353 return NGX_HTTP_UPSTREAM_INVALID_HEADER; |
364 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, | 364 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, |
365 "key: \"%V\" was not found by memcached", &ctx->key); | 365 "key: \"%V\" was not found by memcached", &ctx->key); |
366 | 366 |
367 u->headers_in.status_n = 404; | 367 u->headers_in.status_n = 404; |
368 u->state->status = 404; | 368 u->state->status = 404; |
369 u->keepalive = 1; | |
369 | 370 |
370 return NGX_OK; | 371 return NGX_OK; |
371 } | 372 } |
372 | 373 |
373 no_valid: | 374 no_valid: |
405 ngx_http_upstream_t *u; | 406 ngx_http_upstream_t *u; |
406 | 407 |
407 u = ctx->request->upstream; | 408 u = ctx->request->upstream; |
408 b = &u->buffer; | 409 b = &u->buffer; |
409 | 410 |
410 if (u->length == ctx->rest) { | 411 if (u->length == (ssize_t) ctx->rest) { |
411 | 412 |
412 if (ngx_strncmp(b->last, | 413 if (ngx_strncmp(b->last, |
413 ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest, | 414 ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest, |
414 bytes) | 415 bytes) |
415 != 0) | 416 != 0) |
424 } | 425 } |
425 | 426 |
426 u->length -= bytes; | 427 u->length -= bytes; |
427 ctx->rest -= bytes; | 428 ctx->rest -= bytes; |
428 | 429 |
430 if (u->length == 0) { | |
431 u->keepalive = 1; | |
432 } | |
433 | |
429 return NGX_OK; | 434 return NGX_OK; |
430 } | 435 } |
431 | 436 |
432 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { | 437 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { |
433 ll = &cl->next; | 438 ll = &cl->next; |
461 last += u->length - NGX_HTTP_MEMCACHED_END; | 466 last += u->length - NGX_HTTP_MEMCACHED_END; |
462 | 467 |
463 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) { | 468 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) { |
464 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, | 469 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, |
465 "memcached sent invalid trailer"); | 470 "memcached sent invalid trailer"); |
471 | |
472 b->last = last; | |
473 cl->buf->last = last; | |
474 u->length = 0; | |
475 ctx->rest = 0; | |
476 | |
477 return NGX_OK; | |
466 } | 478 } |
467 | 479 |
468 ctx->rest -= b->last - last; | 480 ctx->rest -= b->last - last; |
469 b->last = last; | 481 b->last = last; |
470 cl->buf->last = last; | 482 cl->buf->last = last; |
471 u->length = ctx->rest; | 483 u->length = ctx->rest; |
484 | |
485 if (u->length == 0) { | |
486 u->keepalive = 1; | |
487 } | |
472 | 488 |
473 return NGX_OK; | 489 return NGX_OK; |
474 } | 490 } |
475 | 491 |
476 | 492 |