nginx 1.21.1 主线版更新log
Changes with nginx 1.21.1 06 Jul 2021
*) Change: now nginx always returns an error for the CONNECT method.
—
http://hg.nginx.org/nginx
http://hg.nginx.org/nginx/rev/63c66b7cc07c
在请求头解析时,对CONNECT请求给予明确拒绝,即返回405 Not Allowed。有几点
理由:
1,nginx不是一个正向代理,因此没太大必要支持CONNECT。
2,nginx目前不支持RFC 7230针对CONNECT的消息长度规则,所以直接拒绝CONNECT
请求避免潜在错误。
–
在之前的版本,对nginx发起CONNECT请求也可能会收到405 Not Allowed错误,比如
如果只配置了静态页面,那么ngx_http_static_handler函数会返回405。
$ curl -X "CONNECT" 127.0.0.1:8080 <html> <head><title>405 Not Allowed</title></head> <body> <center> <h1>405 Not Allowed</h1> </center> <hr> <center>nginx/1.20.1</center> </body> </html>
*) Change: now nginx always returns an error if both “Content-Length”
and “Transfer-Encoding” header lines are present in the request.
—
http://hg.nginx.org/nginx/rev/bea0f9e5c309
在RFC2068里新引入了Transfer-Encoding头来表示消息长度,为了兼容之前的
HTTP1.0,之前的表示消息长度的Content-Length头肯定还是得有,但既然有两
个表示消息长度的头,所以就有一些应用规则,这在RFC文档里有描述:
https://www.ietf.org/rfc/rfc2068.txt
在4.4 Message Length有相关描述,也可以看这里:
https://blog.csdn.net/u013620635/article/details/100622909
应用规则有些绕,而且在实际生产中也基本不会有这两个头同时存在的情况,除
非是在攻击请求中,因此在nginx的这次更新里,就直接简单明确的禁止即可。
*) Change: now nginx always returns an error if spaces or control
characters are used in the request line.
*) Change: now nginx always returns an error if spaces or control
characters are used in a header name.
*) Change: now nginx always returns an error if spaces or control
characters are used in the “Host” request header line.
—
http://hg.nginx.org/nginx/rev/e0fdd75871e4
http://hg.nginx.org/nginx/rev/41f4bd4c51f1
http://hg.nginx.org/nginx/rev/b4073527be81
http://hg.nginx.org/nginx/rev/52338ddf9e2f
禁止在请求行(包括URI,header names,Host header)里使用空白字符或控制字符。
1,之前在URI里允许空白字符是为了兼容一些陈旧或错误的客户端,实际来看害处大
于益处。
2,更新后的版本,URI里的空白字符或控制字符必须进行编码才行。
总体来说,这几个改动,主要是为了更安全,而且也没有明显的副作用。
*) Change: optimization of configuration testing when using many
listening sockets.
—
http://hg.nginx.org/nginx/rev/c860f0b7010c
http://hg.nginx.org/nginx/rev/46815874bcc6
https://trac.nginx.org/nginx/ticket/2187
https://trac.nginx.org/nginx/ticket/2188
两个加速配置测试的优化改进,比如不创建监听套接字等。
*) Bugfix: nginx did not escape “””, “<“, “>”, “\”, “^”, “`”, “{“, “|”,
and “}” characters when proxying with changed URI.
—
http://hg.nginx.org/nginx/rev/dfd8dfb436e5
https://trac.nginx.org/nginx/ticket/2191
https://www.cnblogs.com/panchanggui/p/9436348.html
严格按照RFC3986规范对URI里的字符进行编码。比如,在之前版本就没有对”>”进行编
码,就导致MS Exchange应用出错。
*) Bugfix: SSL variables might be empty when used in logs; the bug had
appeared in 1.19.5.
—
http://hg.nginx.org/nginx/rev/5f765427c17a
http://mailman.nginx.org/pipermail/nginx/2021-May/060670.html
对于lingering_close的套接字,其相关ssl变量也需延迟释放,否则可能导致某些日志
无法正常获取到对应的ssl变量值。
*) Bugfix: keepalive connections with gRPC backends might not be closed
after receiving a GOAWAY frame.
—
http://hg.nginx.org/nginx/rev/021416fca094
gRPC中的GOAWAY帧表示要关闭一个连接。再之前版本,nginx收到该帧后,仍然可以对
当前连接保持keepalive状态,即允许该连接上有新流过来。但事实上,应该做限制,
即关闭keepalive状态。
本次修改增加了一个是否收到GOAWAY帧的标记,然后判断该标记对是否要保持keepalive
做处理。
*) Bugfix: reduced memory consumption for long-lived requests when
proxying with more than 64 buffers.
—
http://hg.nginx.org/nginx/rev/7f5e3595caff
http://hg.nginx.org/nginx/rev/ecf2a9002b37
https://trac.nginx.org/nginx/ticket/1408
特定场景:超大文件下载,https://github.com/owncloud/core/issues/29328
解决了一个特定场景下的“内存泄漏”Bug,也不算真正的内存泄漏,就是这部分内存的
释放在connection关闭时才进行,因此在特定场景下,如果这部分内存特别大,就会有
较明显的负面影响了。
转载请保留地址:http://www.lenky.info/archives/2021/07/2985 或 http://lenky.info/?p=2985
备注:如无特殊说明,文章内容均出自Lenky个人的真实理解而并非存心妄自揣测来故意愚人耳目。由于个人水平有限,虽力求内容正确无误,但仍然难免出错,请勿见怪,如果可以则请留言告之,并欢迎来信讨论。另外值得说明的是,Lenky的部分文章以及部分内容参考借鉴了网络上各位网友的热心分享,特别是一些带有完全参考的文章,其后附带的链接内容也许更直接、更丰富,而我只是做了一下归纳&转述,在此也一并表示感谢。关于本站的所有技术文章,欢迎转载,但请遵从CC创作共享协议,而一些私人性质较强的心情随笔,建议不要转载。
法律:根据最新颁布的《信息网络传播权保护条例》,如果您认为本文章的任何内容侵犯了您的权利,请以Email或书面等方式告知,本站将及时删除相关内容或链接。