Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


   


   


   















      :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ngx_http_userid_module userid_domain ?


  • To: nginx-ru@xxxxxxxxx
  • Subject: Re: ngx_http_userid_module userid_domain ?
  • From: Dmitry Koterov <dmitry@xxxxxxxxxx>
  • Date: Fri, 9 Apr 2010 02:12:07 +0400
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:from:date:x-google-sender-auth:received :message-id:subject:to:content-type; bh=ZEw79UfeXlwT5LbJI1I9cpQ3ca7rkpRnMgsXoQffC0U=; b=bDCqSWJEHjSoZL2HZRJVvQN6Ta2DWfBA68xSwkNazNfkTB1g3x6h9/1cnAdmMfskiO dAwLZ3WRmkx3PX64CixAHvZFlkXALvAzHaWyuUf0IQ80S4aEKRalRG5D4neS0hJRkQ3t hn3Yw0zMzyNp2bwZw3U2XnAxn9cPN9Q6rIDRI=
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=MgbhWqQ+htaQc4RDA1WzMmccxdJ3LoV9wf7pYrUBsIshw/sSxcUysSfeg2nLmFa4ZR hkeubfg8Sfw6EoqFf1tUlGHjW9jl3iK6VOfYDNoFcJoTKts4WI5dxXBXMEzmR+lZ3T/r nyPn5umgS3O/8taAoYQ4Bf8c2ffaWXu8Xm5LM=
  • In-reply-to: <s2nd7df81621004081338gcae35c9h3776215b8d0c146b@xxxxxxxxxxxxxx>
  • References: <s2nd7df81621004081338gcae35c9h3776215b8d0c146b@xxxxxxxxxxxxxx>

, :

perl_require "Digest/MD5.pm";
perl_set $uuid 'sub {
my $r = shift;
my $uuid = "";
if (($r->header_in("Cookie")||"") =~ /\buuid=([^;]+)/) {
$uuid = $1;
} else {
my $domain = $r->header_in("Host");
if ($domain !~ /\bstatic\./s && $domain =~ /(\w+ \. \w+)$/xs) {
$domain = $1;
$uuid = Digest::MD5::md5_hex("super-secret" . time() . int(rand(2000000000)));
$r->header_out(
"Set-Cookie",
"uuid=$uuid; expires=Wed, 08 Jul 2037 22:53:52 GMT; domain=.$domain; path=/"
);

$r->header_out("P3P", q{policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR STA NID"});
}
}
return $uuid;
}';

# Run uuid calculation & header set (use its side-effect: header
# X-Uuid is not used, we only need to execute $uuid-bound Perl code).
add_header X-Uuid $uuid;

...

# Add uuid fo access_log.
log_format main '... "$uuid"';


( - 2800 3000).
, , wget- 2 ( uuid ).




2010/4/9 Dmitry Koterov <dmitry@xxxxxxxxxx>
- "domain=$base_domain" ( ):

set $base_domain "none";
if ($http_host ~* "([^.]+\.[^.]+)$") {
set $base_domain $1;
}
...
userid_domain $base_domain;

. server, , userid_domain.

- ?

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.