comparison src/http/modules/ngx_http_memcached_module.c @ 326:f70f2f565fe0 NGINX_0_5_33

nginx 0.5.33 *) Change: now by default the "echo" SSI command uses entity encoding. *) Feature: the "encoding" parameter in the "echo" SSI command. *) Change: mail proxy was split on three modules: pop3, imap and smtp. *) Feature: the --without-mail_pop3_module, --without-mail_imap_module, and --without-mail_smtp_module configuration parameters. *) Feature: the "smtp_greeting_delay" and "smtp_client_buffer" directives of the ngx_mail_smtp_module. *) Feature: the "server_name" and "valid_referers" directives support regular expressions. *) Feature: the "server_name", "map", and "valid_referers" directives support the "www.example.*" wildcards. *) Bugfix: sub_filter did not work with empty substitution. *) Bugfix: in sub_filter parsing. *) Bugfix: a worker process may got caught in an endless loop, if the memcached was used. *) Bugfix: nginx supported low case only "close" and "keep-alive" values in the "Connection" request header line; bug appeared in 0.5.32. *) Bugfix: nginx could not start on Solaris if the shared PCRE library located in non-standard place was used.
author Igor Sysoev <http://sysoev.ru>
date Wed, 07 Nov 2007 00:00:00 +0300
parents 1e9e2c5e7c14
children 26ff8d6b618d
comparison
equal deleted inserted replaced
325:5bb1b28ddeaa 326:f70f2f565fe0
423 b = &u->buffer; 423 b = &u->buffer;
424 424
425 if (u->length == ctx->rest) { 425 if (u->length == ctx->rest) {
426 426
427 if (ngx_strncmp(b->last, 427 if (ngx_strncmp(b->last,
428 ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END 428 ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
429 - ctx->rest, 429 ctx->rest)
430 bytes) != 0) 430 != 0)
431 { 431 {
432 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, 432 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
433 "memcached sent invalid trailer"); 433 "memcached sent invalid trailer");
434 } 434 }
435 435
436 u->length -= bytes; 436 u->length = 0;
437 ctx->rest -= bytes; 437 ctx->rest = 0;
438 438
439 return NGX_OK; 439 return NGX_OK;
440 } 440 }
441 441
442 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) { 442 for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) {
451 cl->buf->flush = 1; 451 cl->buf->flush = 1;
452 cl->buf->memory = 1; 452 cl->buf->memory = 1;
453 453
454 *ll = cl; 454 *ll = cl;
455 455
456 cl->buf->pos = b->last; 456 last = b->last;
457 cl->buf->pos = last;
457 b->last += bytes; 458 b->last += bytes;
458 cl->buf->last = b->last; 459 cl->buf->last = b->last;
459 460
460 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0, 461 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0,
461 "memcached filter bytes:%z size:%z length:%z rest:%z", 462 "memcached filter bytes:%z size:%z length:%z rest:%z",
462 bytes, b->last - b->pos, u->length, ctx->rest); 463 bytes, b->last - b->pos, u->length, ctx->rest);
463 464
464 if (b->last - b->pos <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) { 465 if (bytes <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) {
465 u->length -= bytes; 466 u->length -= bytes;
466 return NGX_OK; 467 return NGX_OK;
467 } 468 }
468 469
469 470 last += u->length - NGX_HTTP_MEMCACHED_END;
470 last = b->pos + u->length - NGX_HTTP_MEMCACHED_END;
471 471
472 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) { 472 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) {
473 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0, 473 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
474 "memcached sent invalid trailer"); 474 "memcached sent invalid trailer");
475 } 475 }
476 476
477 ctx->rest = u->length - (b->last - b->pos); 477 ctx->rest -= b->last - last;
478 b->last = last; 478 b->last = last;
479 cl->buf->last = last; 479 cl->buf->last = last;
480 u->length = ctx->rest; 480 u->length = ctx->rest;
481 481
482 return NGX_OK; 482 return NGX_OK;