File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ sub fix_headers {
7373
7474 # Host
7575 my $url = $self -> url;
76- $headers -> host($url -> host_port) unless $headers -> host;
76+ $headers -> host($url -> host_port // ' ' ) unless defined $headers -> host;
7777
7878 # Basic authentication
7979 if ((my $info = $url -> userinfo) && !$headers -> authorization) {
Original file line number Diff line number Diff line change @@ -475,6 +475,11 @@ subtest 'Parse full HTTP 1.0 request (no scheme and empty elements in path)' =>
475475 is $req -> url, ' //foo/bar//baz.html?foo=13' , ' right URL' ;
476476 is $req -> headers-> content_type, ' text/plain' , ' right "Content-Type" value' ;
477477 is $req -> headers-> content_length, 27, ' right "Content-Length" value' ;
478+ is $req -> headers-> host, undef , ' "Host" value is not defined' ;
479+
480+ $req -> fix_headers;
481+ is $req -> url-> host, undef , ' still no URL host' ;
482+ is $req -> headers-> host, ' ' , ' "Host" value is fixed' ;
478483};
479484
480485subtest ' Parse full HTTP 1.0 request (behind reverse proxy)' => sub {
You can’t perform that action at this time.
0 commit comments