--- AnyEvent-HTTP/HTTP.pm 2008/06/05 15:34:00 1.11 +++ AnyEvent-HTTP/HTTP.pm 2008/06/05 16:43:45 1.13 @@ -123,7 +123,9 @@ =item headers => hashref -The request headers to use. +The request headers to use. Currently, C may provide its +own C, C, C and C headers +and will provide defaults for C and C. =item timeout => $seconds @@ -183,12 +185,13 @@ =cut +sub _slot_schedule; sub _slot_schedule($) { my $host = shift; while ($CO_SLOT{$host}[0] < $MAX_PER_HOST) { if (my $cb = shift @{ $CO_SLOT{$host}[1] }) { - # somebody wnats that slot + # somebody wants that slot ++$CO_SLOT{$host}[0]; $cb->(AnyEvent::Util::guard { @@ -198,7 +201,6 @@ } else { # nobody wants the slot, maybe we can forget about it delete $CO_SLOT{$host} unless $CO_SLOT{$host}[0]; - warn "$host deleted" unless $CO_SLOT{$host}[0];#d# last; } } @@ -244,6 +246,8 @@ : $scheme eq "https" ? 443 : return $cb->(undef, { Status => 599, Reason => "only http and https URL schemes supported" }); + $hdr{referer} ||= "$scheme://$authority$upath"; # leave out fragment and query string, just a heuristic + $authority =~ /^(?: .*\@ )? ([^\@:]+) (?: : (\d+) )?$/x or return $cb->(undef, { Status => 599, Reason => "unparsable URL" }); @@ -398,7 +402,7 @@ } } - if ($_[1]{Status} =~ /^x30[12]$/ && $recurse) { + if ($_[1]{Status} =~ /^30[12]$/ && $recurse) { # microsoft and other assholes don't give a shit for following standards, # try to support a common form of broken Location header. $_[1]{location} =~ s%^/%$scheme://$uhost:$uport/%;