PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|Proxy|HoTTProxy|HoTTProxy.pl =

page 6 of 12



           }
           foreach $j (@headerList) {
            say ("Caught Set-Cookie: $j\n",5);
            # print STDERR "$j\n";
            my %cookie = parseNetscapeCookie($j,$$message{'_request'}{'_headers'}{'host'},$url);
      logevent 
($$self{'_hphf_proxy'}{'HoTTProxy-Request-User'},$$message{'_request'}{'_headers'}{'x-forwarded-for'
},"Host: $$message{'_request'}{'_headers'}{'host'}\tSet-Cookie\t$j") if $logDetail;
 
            say ("Parsed Cookie: $cookie{'name'}, Domain: $cookie{'domain'}, Path: $cookie{'path'}, 
Expires: $cookie{'expires'}\n",5);

            # Check to see if we've already read in the bag of cookies for this domain restriction
            # If not, read it in
            if (not defined 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}) {  # Cookie organization in memory is 
{'HoTTProxy-Cookie-Jar'}{username}{domain_restriction}{cookie_path/name}
             # print STDERR "Cookie bag wasn't in memory...\n";
             if (-e 
"$HoTTProxyConfig{'CookieDirectory'}/$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}\@$cookie{'domai
n'}.cookies") {  # format for cookie bag filename is username@domain_restriction.cookies
              # print STDERR "Cookie bag existed on disk...\n";
              my $fileHandle;
              if (open ($fileHandle, 
"$HoTTProxyConfig{'CookieDirectory'}/$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}\@$cookie{'domai
n'}.cookies")) {
               # print STDERR "Opened cookie bag on disk...\n";
               # print STDERR "Assigned fileHandle to array...\n";
               # print STDERR "Entering read loop...\n";
               while (<$fileHandle>) {
                chomp $_;
                if ($_) {
                 my %tempCookie = parseStoredCookie($_);
                 if ($tempCookie{'name'}) {
                  my $cookieID = lc($tempCookie{'path'}) . lc($tempCookie{'name'});  # We're naming 
the cookie $path . $name so that cookies from the same path, domain, and name, will overwrite old 
ones
                  
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$temp
Cookie{'domain'}}{$cookieID} = {%tempCookie};
                 }
                }
               }
               close $fileHandle;
              }
             }
            }
            # Now write the new cookie into memory
            my $cookieID = lc($cookie{'path'}) . lc($cookie{'name'});
            # print STDERR "Old: \n";
            # print STDERR "      Name: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'name'}\n";
            # print STDERR "     Value: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'value'}\n";
            # print STDERR "    Domain: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'domain'}\n";
            # print STDERR "      Path: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'path'}\n";
            # print STDERR "   Expires: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'expires'}\n";
            # print STDERR "    Secure: 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{$cookieID}{'secure'}\n";
            # print STDERR "\n";
 
            if (not defined 
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{':=Updated=:'}) {   # Check to see if this cookie bag is already "hot" and needs to 
be updated
             # print STDERR ":=Updated=: was not defined\n";
               if 
(scalar(keys(%{$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Reques
t-User'}}{$cookie{'domain'}}{$cookieID}})) < 1) { # Check to see if there was anything in the 
original cookie and if not this is new without any further checking needed
              say ("\nMade cookie bag $cookie{'domain'} hot.",5);
              
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{':=Updated=:'} = 1; # Note that an update to this cookie bag has occurred so we know 
to save it later
             } else {
              # print STDERR "The original key was defined.\n";
                foreach $i 
(keys(%{$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'
}}{$cookie{'domain'}}{$cookieID}})) {
                 # print STDERR "NV $i\n";
                 if 
($$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$coo
kie{'domain'}}{$cookieID}{$i} ne $cookie{$i}) {
                  say ("\nMade cookie bag $cookie{'domain'} hot.\n\n",5);
                  
$$self{'_hphf_proxy'}{'HoTTProxy-Cookie-Jar'}{$$self{'_hphf_proxy'}{'HoTTProxy-Request-User'}}{$cook
ie{'domain'}}{':=Updated=:'} = 1; # Note that an update to this cookie bag has occurred so we know 
to save it later
                 } else {
=6=

1|2|3|4|5| < PREV = PAGE 6 = NEXT > |7|8|9|10|11|12

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00640297 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)