[nginx] svn commit: r4638 - in trunk/src/http: . modules
ru at nginx.com
ru at nginx.com
Wed May 16 13:27:05 UTC 2012
Author: ru
Date: 2012-05-16 13:27:04 +0000 (Wed, 16 May 2012)
New Revision: 4638
URL: http://trac.nginx.org/nginx/changeset/4638/nginx
Log:
Zero padded the returned and logged HTTP status code, and fixed possible
buffer overrun in $status handling.
Modified:
trunk/src/http/modules/ngx_http_log_module.c
trunk/src/http/ngx_http_header_filter_module.c
Modified: trunk/src/http/modules/ngx_http_log_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_log_module.c 2012-05-16 13:22:03 UTC (rev 4637)
+++ trunk/src/http/modules/ngx_http_log_module.c 2012-05-16 13:27:04 UTC (rev 4638)
@@ -205,7 +205,7 @@
{ ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec },
{ ngx_string("request_time"), NGX_TIME_T_LEN + 4,
ngx_http_log_request_time },
- { ngx_string("status"), 3, ngx_http_log_status },
+ { ngx_string("status"), NGX_INT_T_LEN, ngx_http_log_status },
{ ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent },
{ ngx_string("body_bytes_sent"), NGX_OFF_T_LEN,
ngx_http_log_body_bytes_sent },
@@ -593,7 +593,7 @@
status = 0;
}
- return ngx_sprintf(buf, "%ui", status);
+ return ngx_sprintf(buf, "%03ui", status);
}
Modified: trunk/src/http/ngx_http_header_filter_module.c
===================================================================
--- trunk/src/http/ngx_http_header_filter_module.c 2012-05-16 13:22:03 UTC (rev 4637)
+++ trunk/src/http/ngx_http_header_filter_module.c 2012-05-16 13:27:04 UTC (rev 4638)
@@ -445,7 +445,7 @@
b->last = ngx_copy(b->last, status_line->data, status_line->len);
} else {
- b->last = ngx_sprintf(b->last, "%ui", status);
+ b->last = ngx_sprintf(b->last, "%03ui", status);
}
*b->last++ = CR; *b->last++ = LF;
More information about the nginx-devel
mailing list