stream: sub variable len after output log to the buf

Vladimir Homutov vl at nginx.com
Thu Aug 13 14:10:37 UTC 2015


On Thu, Aug 13, 2015 at 10:17:43AM +0800, Duan Jiong wrote:
> # HG changeset patch
> # User Duan Jiong <djduanjiong at gmail.com>
> # Date 1439431265 -28800
> #      Thu Aug 13 10:01:05 2015 +0800
> # Node ID 1c518d211b6b1acbd3a951218d948bd5ee4bec41
> # Parent  1bd5eb20bd7c25f6cff96190d3ec048e3f3ebeec
> stream: sub variable len after output log to the buf
>
> Otherwise, the log before will be overwrote.
>
> diff -r 1bd5eb20bd7c -r 1c518d211b6b src/stream/ngx_stream_handler.c
> --- a/src/stream/ngx_stream_handler.c Wed Aug 12 12:56:59 2015 +0300
> +++ b/src/stream/ngx_stream_handler.c Thu Aug 13 10:01:05 2015 +0800
> @@ -328,6 +328,7 @@
>      p = ngx_snprintf(buf, len, ", client: %V, server: %V",
>                       &s->connection->addr_text,
>                       &s->connection->listening->addr_text);
> +    len -= p - buf;
>
>      if (s->log_handler) {
>          return s->log_handler(log, p, len);
>

Thank you for reporting this! Slightly modified version committed:
http://hg.nginx.org/nginx/rev/d1f94042c29c



More information about the nginx-devel mailing list