ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/HTTP.pm
(Generate patch)

Comparing AnyEvent-HTTP/HTTP.pm (file contents):
Revision 1.23 by root, Wed Jul 2 01:23:41 2008 UTC vs.
Revision 1.24 by root, Wed Jul 2 01:30:33 2008 UTC

412 $arg{cookie_jar}{version} = 1; 412 $arg{cookie_jar}{version} = 1;
413 $arg{cookie_jar}{$cdom}{$cpath}{$name} = \%kv; 413 $arg{cookie_jar}{$cdom}{$cpath}{$name} = \%kv;
414 } 414 }
415 } 415 }
416 416
417 # microsoft and other assholes don't give a shit for following standards,
418 # try to support a common form of broken Location header.
419 $_[1]{location} =~ s%^/%$scheme://$uhost:$uport/%
420 if exists $_[1]{location};
421
417 if ($_[1]{Status} =~ /^30[12]$/ && $recurse && $method ne "POST") { 422 if ($_[1]{Status} =~ /^30[12]$/ && $recurse && $method ne "POST") {
418 # microsoft and other assholes don't give a shit for following standards,
419 # try to support a common form of broken Location header.
420 $_[1]{location} =~ s%^/%$scheme://$uhost:$uport/%;
421
422 # apparently, mozilla et al. just change POST to GET here 423 # apparently, mozilla et al. just change POST to GET here
423 # more research is needed before we do the same 424 # more research is needed before we do the same
424
425 http_request ($method, $_[1]{location}, %arg, recurse => $recurse - 1, $cb); 425 http_request ($method, $_[1]{location}, %arg, recurse => $recurse - 1, $cb);
426 } elsif ($_[1]{Status} == 303 && $recurse) { 426 } elsif ($_[1]{Status} == 303 && $recurse) {
427 $_[1]{location} =~ s%^/%$scheme://$uhost:$uport/%; 427 # even http/1.1 is unlear on how to mutate the method
428 428 $method = "GET" unless $method eq "HEAD";
429 http_request (GET => $_[1]{location}, %arg, recurse => $recurse - 1, $cb); 429 http_request ($method => $_[1]{location}, %arg, recurse => $recurse - 1, $cb);
430 } elsif ($_[1]{Status} == 307 && $recurse && $method =~ /^(?:GET|HEAD)$/) {
431 http_request ($method => $_[1]{location}, %arg, recurse => $recurse - 1, $cb);
430 } else { 432 } else {
431 $cb->($_[0], $_[1]); 433 $cb->($_[0], $_[1]);
432 } 434 }
433 }; 435 };
434 436

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines