diff src/http/ngx_http_special_response.c @ 6885:25203fc377fb

Implemented the "server_tokens build" option. Based on a patch by Tom Thorogood.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 31 Jan 2017 12:09:40 +0300
parents 92ad1c92bcf9
children 3ef4cadfad7f
line wrap: on
line diff
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -25,6 +25,13 @@ static u_char ngx_http_error_full_tail[]
 ;
 
 
+static u_char ngx_http_error_build_tail[] =
+"<hr><center>" NGINX_VER_BUILD "</center>" CRLF
+"</body>" CRLF
+"</html>" CRLF
+;
+
+
 static u_char ngx_http_error_tail[] =
 "<hr><center>nginx</center>" CRLF
 "</body>" CRLF
@@ -628,10 +635,14 @@ ngx_http_send_special_response(ngx_http_
     ngx_uint_t    msie_padding;
     ngx_chain_t   out[3];
 
-    if (clcf->server_tokens) {
+    if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
         len = sizeof(ngx_http_error_full_tail) - 1;
         tail = ngx_http_error_full_tail;
 
+    } else if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_BUILD) {
+        len = sizeof(ngx_http_error_build_tail) - 1;
+        tail = ngx_http_error_build_tail;
+
     } else {
         len = sizeof(ngx_http_error_tail) - 1;
         tail = ngx_http_error_tail;