true 414 status code

Валентин Бартенев vbart at nginx.com
Wed Sep 4 10:51:01 UTC 2013


On Wednesday 04 September 2013 13:54:18 Vladimir Getmanshchuk wrote:
> Даже идиотизм типа:
> 
>         error_page 414 =414 @414;
> 
>         location @414 {
>           return 414;
>         }
> не дал результат - получаю 200
> 
> 2013/09/04 09:40:10 [info] 5564#0: *45 client sent too long URI while
> reading client request line, client: 123.123.123.123, server:
> host.example.com, request: "GET
> /file.php?qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasd
> fghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiop
> asdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyu
> iopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwer
> tyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmq
> wertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvb
> nmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzx
> cvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjk
> lzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfg
> hjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopas
> dfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuio
> pasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwerty
> uiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwe
> rtyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm
> qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcv
> bnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklz
> xcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghj
> klzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdf
> ghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopa
> sdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyui
> opasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwert
> yuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqw
> ertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbn
> mqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxc
> vbnmqwertyuiopasdfghjklzxcvbnmqwer 2013/09/04 09:40:10 [debug] 5564#0: *45
> http finalize request: 414, "?" a:1, c:1
> 2013/09/04 09:40:10 [debug] 5564#0: *45 event timer del: 15: 1378287669763
> 2013/09/04 09:40:10 [debug] 5564#0: *45 http special response: 414, "?"
> 2013/09/04 09:40:10 [debug] 5564#0: *45 test location: "@414"
> 2013/09/04 09:40:10 [debug] 5564#0: *45 using location: @414 "?"
> 2013/09/04 09:40:10 [debug] 5564#0: *45 rewrite phase: 3
> 2013/09/04 09:40:10 [debug] 5564#0: *45 http finalize request: 414, "?"
> a:1, c:2
> 2013/09/04 09:40:10 [debug] 5564#0: *45 http special response: 414, "?"
> 2013/09/04 09:40:10 [debug] 5564#0: *45 http set discard body
> 2013/09/04 09:40:10 [debug] 5564#0: *45 xslt filter header
> 2013/09/04 09:40:10 [debug] 5564#0: *45 HTTP/1.1
> Server: nginx/1.2.9
> Date: Wed, 04 Sep 2013 09:40:10 GMT
> Content-Type: text/html
> Content-Length: 192
> Connection: close
> 
[..]

Это не 200, а просто невалидный ответ.  Патч, исправляющий проблему, уже лежит
на ревью: http://mailman.nginx.org/pipermail/nginx-devel/2013-April/003609.html

Плюс вдогонку ещё один:

# HG changeset patch
# User Valentin Bartenev <vbart at nginx.com>
# Date 1378228039 -14400
# Node ID 9f8ebfbe04f28544fd9cfc1473679aee13202506
# Parent  659464c695b7c70f64207462d0e1a4ee3d018583
Return reason phrase for 414.

After 62be77b0608f nginx can return this code.

diff -r 659464c695b7 -r 9f8ebfbe04f2 src/http/ngx_http_header_filter_module.c
--- a/src/http/ngx_http_header_filter_module.c  Mon Sep 02 20:06:03 2013 +0400
+++ b/src/http/ngx_http_header_filter_module.c  Tue Sep 03 21:07:19 2013 +0400
@@ -92,10 +92,7 @@ static ngx_str_t ngx_http_status_lines[]
     ngx_string("411 Length Required"),
     ngx_string("412 Precondition Failed"),
     ngx_string("413 Request Entity Too Large"),
-    ngx_null_string,  /* "414 Request-URI Too Large", but we never send it
-                       * because we treat such requests as the HTTP/0.9
-                       * requests and send only a body without a header
-                       */
+    ngx_string("414 Request-URI Too Large"),
     ngx_string("415 Unsupported Media Type"),
     ngx_string("416 Requested Range Not Satisfiable"),
 

--
Валентин



Подробная информация о списке рассылки nginx-ru