Opened 4 years ago

Closed 4 years ago

#2184 closed defect (duplicate)

ngx_http_parse_header_line

Reported by: https://stackoverflow.com/users/279251/klaus-triendl Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.19.x
Keywords: Cc: https://stackoverflow.com/users/279251/klaus-triendl
uname -a:
nginx -V: nginx version: nginx/1.19.10
built by cl 16.00.40219.01 for 80x86
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.44 --with-zlib=objs.msvc8/lib/zlib-1.2.11 --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.1.1k --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

Description

nginx treats dots "." as invalid characters in HTTP header field names, which it shouldn't according to RFC 7230.

RFC 7230 defines a header field name to be a 'token' as follows:

field-name = token
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
        / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
        / DIGIT / ALPHA
        ; any VCHAR, except delimiters

(see section Header Fields and section Field Value Components)

however, ngx_http_parse_header_line() only accepts the underscore "_" outside of alpha-numeric characters and the dash.

My use case are custom client HTTP headers in "reverse domain notation".

Change History (3)

comment:1 by Sergey Kandaurov, 4 years ago

comment:2 by https://stackoverflow.com/users/279251/klaus-triendl, 4 years ago

Sergey, thanks for linking to the discussion on github. So, what's the outcome of this?

comment:3 by Maxim Dounin, 4 years ago

Resolution: duplicate
Status: newclosed

Closing this as a duplicate of #629. I believe this comment is pretty clear, feel free to ask if you have any further questions.

Note: See TracTickets for help on using tickets.