Welcome! Log In Create A New Profile

Advanced

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Francis Daly
October 27, 2013 05:46PM
On Sun, Oct 27, 2013 at 09:45:40PM +0100, Lukas Tribus wrote:

Hi there,

> > What you have shown looks well-formed to me, but doesn't look as useful
> > as you want.

> > What is confusing is that when I do something similar, I get different
> > output which does not look well-formed to me:

> I think nginx is returning the same thing for you both, and that curl
> fails to parse this bogus HTTP response (maybe you are using different
> curl releases).

If curl isn't showing exactly what is being returned, that would be
disappointing. I guess we could test with "nc" or "tcpdump" if necessary.

> >    Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
>
> While nginx seems to return:
>   HTTP-Version SP Status-Code CRLF
>
> as per Francis' output.
>
> The Reason-Phrase clearly is a hard requirement and cannot be omitted.

It can't be omitted, but it can be zero-length. The SP before it looks
to be the part that shouldn't be omitted.


It looks like a straightforward fix:

diff -pru nginx-1.4.3/src/http/ngx_http_header_filter_module.c nginx-1.4.3-wip/src/http/ngx_http_header_filter_module.c
--- nginx-1.4.3/src/http/ngx_http_header_filter_module.c 2013-10-08 13:07:14.000000000 +0100
+++ nginx-1.4.3/src/http/ngx_http_header_filter_module.c 2013-10-27 21:25:20.693842199 +0000
@@ -448,7 +448,7 @@ ngx_http_header_filter(ngx_http_request_
b->last = ngx_copy(b->last, status_line->data, status_line->len);

} else {
- b->last = ngx_sprintf(b->last, "%03ui", status);
+ b->last = ngx_sprintf(b->last, "%03ui ", status);
}
*b->last++ = CR; *b->last++ = LF;


I think that line 270 in the file, which currently says

len += NGX_INT_T_LEN;

should probably currently say something like

len += 3; /* sizeof("404") */

and should be changed to say something like

len += 4; /* sizeof("404 ") */

but since NGX_INT_T_LEN is at least 4 anyway, len is big enough to hold
the extra space without changing that line.

Extra eyes to ensure I've not done something stupid are welcome.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Brian08275660 October 26, 2013 11:43PM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Francis Daly October 27, 2013 06:06AM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Brian08275660 October 27, 2013 09:40AM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Jonathan Matthews October 27, 2013 10:24AM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Brian08275660 October 27, 2013 01:22PM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Francis Daly October 27, 2013 02:38PM

RE: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Lukas Tribus October 27, 2013 04:48PM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Francis Daly October 27, 2013 05:46PM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

Brian08275660 October 27, 2013 07:25PM

Re: HttpLimitReqModule delivers "nginx/1.4.3" as a message for HTTP status code 429. Too generic!

António P. P. Almeida October 28, 2013 03:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 295
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready