… | |
… | |
104 | headers, the "pseudo-headers" C<HTTPVersion>, C<Status> and C<Reason> |
104 | headers, the "pseudo-headers" C<HTTPVersion>, C<Status> and C<Reason> |
105 | contain the three parts of the HTTP Status-Line of the same name. The |
105 | contain the three parts of the HTTP Status-Line of the same name. The |
106 | pseudo-header C<URL> contains the original URL (which can differ from the |
106 | pseudo-header C<URL> contains the original URL (which can differ from the |
107 | requested URL when following redirects). |
107 | requested URL when following redirects). |
108 | |
108 | |
109 | If the server sends a header multiple lines, then their contents will be |
109 | If the server sends a header multiple times, then their contents will be |
110 | joined together with a command (C<,>). |
110 | joined together with a comma (C<,>), as per the HTTP spec. |
111 | |
111 | |
112 | If an internal error occurs, such as not being able to resolve a hostname, |
112 | If an internal error occurs, such as not being able to resolve a hostname, |
113 | then C<$data> will be C<undef>, C<< $headers->{Status} >> will be C<599> |
113 | then C<$data> will be C<undef>, C<< $headers->{Status} >> will be C<599> |
114 | and the C<Reason> pseudo-header will contain an error message. |
114 | and the C<Reason> pseudo-header will contain an error message. |
115 | |
115 | |
… | |
… | |
372 | |
372 | |
373 | $state{handle}->starttls ("connect") if $rscheme eq "https"; |
373 | $state{handle}->starttls ("connect") if $rscheme eq "https"; |
374 | |
374 | |
375 | # handle actual, non-tunneled, request |
375 | # handle actual, non-tunneled, request |
376 | my $handle_actual_request = sub { |
376 | my $handle_actual_request = sub { |
377 | # $state{handle}->starttls ("connect") if $uscheme eq "https"; |
377 | $state{handle}->starttls ("connect") if $uscheme eq "https"; |
378 | |
378 | |
379 | # send request |
379 | # send request |
380 | $state{handle}->push_write ( |
380 | $state{handle}->push_write ( |
381 | "$method $rpath HTTP/1.0\015\012" |
381 | "$method $rpath HTTP/1.0\015\012" |
382 | . (join "", map "\u$_: $hdr{$_}\015\012", keys %hdr) |
382 | . (join "", map "\u$_: $hdr{$_}\015\012", keys %hdr) |