Patch: Update Server Header for HTTP/1.1
Maxim Dounin
mdounin at mdounin.ru
Sat Feb 24 15:04:16 UTC 2024
Hello!
On Sat, Feb 24, 2024 at 08:50:26PM +0900, Tatsuya Kaneko wrote:
> Hello.
>
> I hope you're doing well. I made a patch for nginx that I want to
> share with you. This patch changes the Server header from "nginx" to
> "freenginx" for HTTP/1.1. You already did this for HTTP/2 and HTTP/3,
> but forgot HTTP/1.1.
>
> What I changed:
>
> File: src/http/ngx_http_header_filter_module.c
> Change: Server header to "freenginx"
>
> Why: To make HTTP/1.1 and HTTP/2 the same for our server signature.
>
> Please see the attached patch file. I look forward to your feedback.
> Let me know if I need to fix anything.
Thanks for catching this. Indeed, missed in 9213:23f109f0facc the
HTTP/1.x case with "server_tokens off;".
> # HG changeset patch
> # User catatsuy <catatsuy at catatsuy.org>
Shouldn't it be "Tatsuya Kaneko <catatsuy at catatsuy.org>"?
> # Date 1708774686 -32400
> # Sat Feb 24 20:38:06 2024 +0900
> # Node ID ce4bdb0116560cf735110ace589764f15ca321d8
> # Parent 8b8b2e1aa77a3539772815bd0d57450bae674e5c
> Update HTTP/1.1 Server header to "freenginx"
Something like this should be more in line with existing style:
: Fixed server name in HTTP/1.x with "server_tokens off;".
:
: Missed in 9213:23f109f0facc.
>
> diff -r 8b8b2e1aa77a -r ce4bdb011656 src/http/ngx_http_header_filter_module.c
> --- a/src/http/ngx_http_header_filter_module.c Tue Feb 20 20:15:32 2024 +0300
> +++ b/src/http/ngx_http_header_filter_module.c Sat Feb 24 20:38:06 2024 +0900
> @@ -46,7 +46,7 @@
> };
>
>
> -static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
> +static u_char ngx_http_server_string[] = "Server: freenginx" CRLF;
> static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
> static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
>
Following 9213:23f109f0facc changes, it should be NGINX_NAME
instead:
-static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
+static u_char ngx_http_server_string[] = "Server: " NGINX_NAME CRLF;
Full updated patch below, please let me know it if looks good for
you:
# HG changeset patch
# User Tatsuya Kaneko <catatsuy at catatsuy.org>
# Date 1708786720 -10800
# Sat Feb 24 17:58:40 2024 +0300
# Node ID 59005d22b945f163f825cd201af991eb0e266206
# Parent 8b8b2e1aa77a3539772815bd0d57450bae674e5c
Fixed server name in HTTP/1.x with "server_tokens off;".
Missed in 9213:23f109f0facc.
diff --git a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -46,7 +46,7 @@ ngx_module_t ngx_http_header_filter_mod
};
-static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
+static u_char ngx_http_server_string[] = "Server: " NGINX_NAME CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list