[PATCH] Use RFC 9110 descriptions for status 413 and 414

Maxim Dounin mdounin at mdounin.ru
Sun Apr 14 01:00:28 UTC 2024


Hello!

On Fri, Apr 12, 2024 at 10:11:40PM +0200, Michiel W. Beijen wrote:

> # HG changeset patch
> # User Michiel W. Beijen <mb at x14.nl>
> # Date 1712950069 -7200
> #      Fri Apr 12 21:27:49 2024 +0200
> # Node ID 58cd6cb2adba48ff9336c2896046e155074fdffd
> # Parent  ccd7e4022a2498a930c9e0927a9820f7ea17ae13
> Use RFC 9110 descriptions for status 413 and 414
> 
> RFC 9110 is accepted as a Standards Track document in June 2022.
> It obsoletes the earlier RFC 7231. It uses slightly different names for
> HTTP status codes 413 and 414.
> 
> Rename the constants and documents returned by nginx to reflect the new
> naming.
> Keep the old constants in place for backwards compatibility.
> 
> ref: https://www.rfc-editor.org/rfc/rfc9110.html

Thanks for the patch. 

Note that 413 was "Payload Too Large" since RFC 7231, which was 
then changed into "Content Too Large" in RFC 9110.  Both reason 
phrases, unfortunately, look worse than "Request Entity Too Large" 
as introduced in RFC 2068, as they require additional information 
to understand if the request or the response content is the source 
of the problem.

And 414 was "Request-URI Too Long" since introduction in RFC 2068, 
and changed to "URI Too Long" in RFC 7231 (and not changed in RFC 
9110).  That is, "Too Large" part is not consistent with any RFCs, 
it should be "Too Long".  The NGX_HTTP_REQUEST_URI_TOO_LARGE name 
dates back to 12:055ed05235ae (nginx-0.0.1-2002-09-13-18:47:42 
import), and likely was borrowed from Apache, which also uses 
similar name (HTTP_REQUEST_URI_TOO_LARGE, see 
https://svn.apache.org/repos/asf/httpd/httpd/trunk/include/httpd.h).

Overall, I tend to think that it would be wrong to change defines, 
even if providing compatibility shims.  OTOH, we can consider 
updating text representations, similarly to how it is already the 
case for 302 (which is NGX_HTTP_MOVED_TEMPORARILY, but "302 
Found").  (But I would rather refrain from changing 413 due to 
the above reason.)

[...]

> diff -r ccd7e4022a24 -r 58cd6cb2adba src/http/ngx_http_header_filter_module.c
> --- a/src/http/ngx_http_header_filter_module.c	Tue Apr 02 20:55:21 2024 +0300
> +++ b/src/http/ngx_http_header_filter_module.c	Fri Apr 12 21:27:49 2024 +0200
> @@ -93,8 +93,8 @@
>      ngx_string("410 Gone"),
>      ngx_string("411 Length Required"),
>      ngx_string("412 Precondition Failed"),
> -    ngx_string("413 Request Entity Too Large"),
> -    ngx_string("414 Request-URI Too Large"),
> +    ngx_string("413 Content Too Large"),
> +    ngx_string("414 URI Too Large"),

Typo: should be "... Too Long".

[...]

-- 
Maxim Dounin
http://mdounin.ru/



More information about the nginx-devel mailing list