[PATCH] fix too much loyality in HTTP method parser

Sergey Shepelev temotor на gmail.com
Вт Дек 1 16:21:29 MSK 2009


2009/12/1 Denis F. Latypoff <latypoff at yandex.ru>:
> Патч фиксит вот такое:
>
> [root at c1 c1]# telnet rambler.ru 80
> Trying 81.19.70.3...
> Connected to rambler.ru (81.19.70.3).
> Escape character is '^]'.
> HI_THERE / HTTP/1.0
> Host: rambler.ru
>
> HTTP/1.1 302 Moved Temporarily
> Server: nginx/0.8.28
> Date: Tue, 01 Dec 2009 03:09:30 GMT
> Content-Type: text/html
> Content-Length: 161
> Connection: close
> Location: http://www.rambler.ru/
>
> <html>
> <head><title>302 Found</title></head>
> <body bgcolor="white">
> <center><h1>302 Found</h1></center>
> <hr><center>nginx/0.8.28</center>
> </body>
> </html>
> Connection closed by foreign host.
>
> :-)

А что здесь фиксить? Очевидно, настроено правило типа rewrite ^
http://www.rambler.ru$request_uri для server_name rambler.ru. Парсится
URI, по нему редирект. На метод тут вообще смотреть не надо. Где
ошибка?

$ curl -v -X HOLA http://www.rambler.ru/
* About to connect() to www.rambler.ru port 80 (#0)
*   Trying 81.19.70.1... connected
* Connected to www.rambler.ru (81.19.70.1) port 80 (#0)
> HOLA / HTTP/1.1
> User-Agent: curl/7.19.5 (x86_64-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15
> Host: www.rambler.ru
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Server: nginx/0.8.28
< Date: Tue, 01 Dec 2009 13:18:54 GMT
< Content-Type: text/html
< Content-Length: 161
< Connection: keep-alive
< Keep-Alive: timeout=50
< Location: http://www.rambler.ru/
< Set-Cookie: dv=gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:1259673534; path=/;
expires=Thu, 31-Dec-37 23:55:55 GMT
< Set-Cookie: dvr=gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:1259673534;
domain=.rambler.ru; path=/; expires=Thu, 31-Dec-37 23:55:55 GMT
< Set-Cookie: lv=1259673534; path=/; expires=Thu, 31-Dec-37 23:55:55 GMT
< Set-Cookie: lvr=1259673534; domain=.rambler.ru; path=/; expires=Thu,
31-Dec-37 23:55:55 GMT
< Set-Cookie: ruid=AQAAAL4XFUuJX9dQASsUAAB=; expires=Thu, 31-Dec-37
23:55:55 GMT; domain=.rambler.ru; path=/
< P3P: CP="NON DSP NID ADMa DEVa TAIa PSAa PSDa OUR IND UNI COM NAV"
<
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/0.8.28</center>
</body>
</html>
* Connection #0 to host www.rambler.ru left intact
* Closing connection #0

А вот здесь уже есть проблема. Спросили www.rambler.ru/ ответили 302
www.rambler.ru/. Циклический редирект. Должно быть 405. Но это,
видимо, уже проблема бекенда.

>
> --
> br, Denis F. Latypoff.
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
>



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