Welcome! Log In Create A New Profile

Advanced

Re: nginx+captcha

July 16, 2010 07:33AM
В общем порылся в дебаглоге, получается следующая картинка:
это кусок лога, записанный при вводе капчи в ФФ
[code]
2010/07/16 08:19:56 [debug] 5412#0: *1 http keepalive handler
2010/07/16 08:19:56 [debug] 5412#0: *1 malloc: 0000000801409400:1024
2010/07/16 08:19:56 [debug] 5412#0: *1 recv: eof:0, avail:446, err:0
2010/07/16 08:19:56 [debug] 5412#0: *1 recv: fd:3 446 of 1024
2010/07/16 08:19:56 [debug] 5412#0: *1 malloc: 0000000801446C00:1256
2010/07/16 08:19:56 [debug] 5412#0: *1 event timer del: 3: 1279268436782
2010/07/16 08:19:56 [debug] 5412#0: *1 generic phase: 0
2010/07/16 08:19:56 [debug] 5412#0: *1 add cleanup: 0000000801439B78
2010/07/16 08:19:56 [debug] 5412#0: *1 generic phase: 1
2010/07/16 08:19:56 [debug] 5412#0: *1 test location: "/"
2010/07/16 08:19:56 [debug] 5412#0: *1 test location: "rcaptcha/"
2010/07/16 08:19:56 [debug] 5412#0: *1 using configuration "/rcaptcha/"
2010/07/16 08:19:56 [debug] 5412#0: *1 http cl:-1 max:1048576
2010/07/16 08:19:56 [debug] 5412#0: *1 generic phase: 3
2010/07/16 08:19:56 [debug] 5412#0: *1 http script var
2010/07/16 08:19:56 [debug] 5412#0: *1 perl variable handler
2010/07/16 08:19:56 [debug] 5412#0: *1 perl variable done
2010/07/16 08:19:56 [debug] 5412#0: *1 http script var: "1"
2010/07/16 08:19:56 [debug] 5412#0: *1 http script value: "1"
2010/07/16 08:19:56 [debug] 5412#0: *1 http script equal
2010/07/16 08:19:56 [debug] 5412#0: *1 http script if
2010/07/16 08:19:56 [debug] 5412#0: *1 http script regex: "^"
2010/07/16 08:19:56 [notice] 5412#0: *1 "^" matches "/rcaptcha/", client: 192.168.50.1, server: sec.grt, request: "GET /rcaptcha/?input=aaa123 HTTP/1.1", host: "sec.grt", referrer: "http://sec.grt/"
2010/07/16 08:19:56 [debug] 5412#0: *1 parse header: "Cookie: fu=/; ct=3731520923"
2010/07/16 08:19:56 [debug] 5412#0: *1 http script var: "/"
2010/07/16 08:19:56 [debug] 5412#0: *1 http script regex end
2010/07/16 08:19:56 [notice] 5412#0: *1 rewritten redirect: "/?input=aaa123", client: 192.168.50.1, server: sec.grt, request: "GET /rcaptcha/?input=aaa123 HTTP/1.1", host: "sec.grt", referrer: "http://sec.grt/"
2010/07/16 08:19:56 [debug] 5412#0: *1 http finalize request: 302, "/rcaptcha/?input=aaa123" 1
2010/07/16 08:19:56 [debug] 5412#0: *1 http special response: 302, "/rcaptcha/?input=aaa123"
2010/07/16 08:19:56 [debug] 5412#0: *1 http set discard body
2010/07/16 08:19:56 [debug] 5412#0: *1 perl variable handler
2010/07/16 08:19:56 [debug] 5412#0: *1 perl variable done
2010/07/16 08:19:56 [debug] 5412#0: *1 http script copy: "ha="
2010/07/16 08:19:56 [debug] 5412#0: *1 http script var: "1208981956"
2010/07/16 08:19:56 [debug] 5412#0: *1 http script copy: "; path=/"
2010/07/16 08:19:56 [debug] 5412#0: *1 HTTP/1.1 302 Moved Temporarily
Server: nginx/0.7.67
Date: Fri, 16 Jul 2010 08:19:56 GMT
Content-Type: text/html
Content-Length: 161
Location: http://sec.grt/?input=aaa123
Connection: keep-alive
Set-Cookie: ha=1208981956; path=/
[/code]

то есть все как надо, ha кука ставится, и дальше все работает
а вот кусок дебага при том-же запросе через Хром

[code]
2010/07/16 08:21:01 [debug] 5412#0: *1 http keepalive handler
2010/07/16 08:21:01 [debug] 5412#0: *1 close http connection: 3
2010/07/16 08:21:01 [debug] 5412#0: *1 free: 0000000000000000
2010/07/16 08:21:01 [debug] 5412#0: *1 free: 0000000000000000
2010/07/16 08:21:01 [debug] 5412#0: *1 free: 000000080149D600, unused: 8
2010/07/16 08:21:01 [debug] 5412#0: *1 free: 000000080149D700, unused: 112
2010/07/16 08:21:03 [debug] 5412#0: *4 event timer del: 3: 1279268523279
2010/07/16 08:21:03 [debug] 5412#0: *4 generic phase: 0
2010/07/16 08:21:03 [debug] 5412#0: *4 add cleanup: 0000000801439B70
2010/07/16 08:21:03 [debug] 5412#0: *4 generic phase: 1
2010/07/16 08:21:03 [debug] 5412#0: *4 test location: "/"
2010/07/16 08:21:03 [debug] 5412#0: *4 test location: "rcaptcha/"
2010/07/16 08:21:03 [debug] 5412#0: *4 using configuration "/rcaptcha/"
2010/07/16 08:21:03 [debug] 5412#0: *4 http cl:-1 max:1048576
2010/07/16 08:21:03 [debug] 5412#0: *4 generic phase: 3
2010/07/16 08:21:03 [debug] 5412#0: *4 http script var
2010/07/16 08:21:03 [debug] 5412#0: *4 perl variable handler
2010/07/16 08:21:03 [debug] 5412#0: *4 perl variable done

[b]2010/07/16 08:21:03 [debug] 5412#0: *4 http script var: "0"[/b] <-------------- что-бы все работало, тут должна быть 1 как я понимаю, но сравнение возвращает 0

2010/07/16 08:21:03 [debug] 5412#0: *4 http script value: "1"
2010/07/16 08:21:03 [debug] 5412#0: *4 http script equal
2010/07/16 08:21:03 [debug] 5412#0: *4 http script equal: no
2010/07/16 08:21:03 [debug] 5412#0: *4 http script if
2010/07/16 08:21:03 [debug] 5412#0: *4 http script if: false
2010/07/16 08:21:03 [debug] 5412#0: *4 http script regex: "^"
2010/07/16 08:21:03 [notice] 5412#0: *4 "^" matches "/rcaptcha/", client: 192.168.50.1, server: sec.grt, request: "GET /rcaptcha/?input=bbb123 HTTP/1.1", host: "sec.grt", referrer: "http://sec.grt/"
2010/07/16 08:21:03 [debug] 5412#0: *4 http script copy: "/test.html"
2010/07/16 08:21:03 [debug] 5412#0: *4 http script regex end
2010/07/16 08:21:03 [notice] 5412#0: *4 rewritten redirect: "/test.html?input=bbb123", client: 192.168.50.1, server: sec.grt, request: "GET /rcaptcha/?input=bbb123 HTTP/1.1", host: "sec.grt", referrer: "http://sec.grt/"
2010/07/16 08:21:03 [debug] 5412#0: *4 http finalize request: 302, "/rcaptcha/?input=bbb123" 1
2010/07/16 08:21:03 [debug] 5412#0: *4 http special response: 302, "/rcaptcha/?input=bbb123"
2010/07/16 08:21:03 [debug] 5412#0: *4 http set discard body
2010/07/16 08:21:03 [debug] 5412#0: *4 HTTP/1.1 302 Moved Temporarily
Server: nginx/0.7.67
Date: Fri, 16 Jul 2010 08:21:03 GMT
Content-Type: text/html
Content-Length: 161
Location: http://sec.grt/test.html?input=bbb123
Connection: keep-alive
[/code]

а вот локейшн и обработчик, которые отвечают за проверку
[code]

location /rcaptcha/ {
if ( $check_input ) {
add_header Set-Cookie "ha=$crc32_ha; path=/";
rewrite ^ $cookie_fu redirect;
}
rewrite ^ /test.html redirect;
}

perl_set $check_input '
sub {
use String::CRC32;
my $r = shift;
my $input=$r->args;
$input=~ s/.*input=(.+)/$1/g;
my $cookie_ct=$r->header_in("Cookie");
$cookie_ct=~ s/.+ct=([^\ ]+).*/$1/g;
if ( $cookie_ct == crc32($input.$r->remote_addr) ) { return 1; } else { return 0; }
}';
[/code]

товарищи, подскажите, где собака порылвсь..? чем Хром так отличается от Оперы и ФФ ?
Subject Author Posted

nginx+captcha

jch June 08, 2010 12:53PM

Re: nginx+captcha

Sergey Shepelev June 08, 2010 01:20PM

Re: nginx+captcha

jch June 11, 2010 08:55AM

Re[2]: nginx+captcha

Михаил Монашёв June 11, 2010 10:48AM

Re: nginx+captcha

Andrey N. Oktyabrski June 11, 2010 11:50AM

Re[2]: nginx+captcha

Михаил Монашёв June 11, 2010 01:28PM

Re[2]: nginx+captcha

Михаил Монашёв June 11, 2010 04:44PM

Re: nginx+captcha

silly sad June 15, 2010 08:04AM

Re[2]: nginx+captcha Attachments

Михаил Монашёв June 16, 2010 03:52AM

Re: nginx+captcha

Andrey N. Oktyabrski June 16, 2010 06:22AM

Re[2]: nginx+captcha

Михаил Монашёв June 16, 2010 03:46AM

Re: nginx+captcha

Anton Bessonov September 07, 2010 12:38PM

Re: nginx+captcha

Vladimir V. Perepelitsa July 18, 2010 08:00PM

Re: Re[2]: nginx+captcha

Boris Dolgov June 11, 2010 03:54PM

Re[4]: nginx+captcha

Михаил Монашёв June 11, 2010 04:06PM

Re: nginx+captcha

silly sad June 15, 2010 01:58AM

Re: nginx+captcha Attachments

Anton Bessonov June 11, 2010 05:58PM

Re: nginx+captcha

Anton Bessonov June 11, 2010 03:06PM

Re: nginx+captcha

Boris Dolgov June 08, 2010 02:12PM

Re: nginx+captcha

big bond June 08, 2010 03:22PM

Re: nginx+captcha

Sergey Shepelev June 08, 2010 03:58PM

Re: nginx+captcha

Александр Кутузов June 08, 2010 04:08PM

Re: nginx+captcha

Igor Sysoev June 08, 2010 04:02PM

Re: nginx+captcha

jch June 08, 2010 03:54PM

Re: nginx+captcha

Boris Dolgov June 08, 2010 04:48PM

Re: nginx+captcha

jch June 14, 2010 11:34AM

Re: nginx+captcha

garrotte July 15, 2010 04:49AM

Re: nginx+captcha

AGvin September 07, 2010 10:30AM

Re: nginx+captcha

Никита Козлов June 14, 2010 01:08PM

Re: nginx+captcha

silly sad June 15, 2010 01:52AM

Re: nginx+captcha

jch June 15, 2010 05:30AM

Re: nginx+captcha

silly sad June 15, 2010 07:50AM

Re: nginx+captcha

vgoncharov June 16, 2010 07:22AM

Re: nginx+captcha

Sergey Shepelev June 16, 2010 07:34AM

Re: nginx+captcha

garrotte July 16, 2010 07:33AM

Re: nginx+captcha

AGvin September 15, 2010 07:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
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