File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 11Revision history for HTTP-Message
22
33{{$NEXT}}
4+ - now handling HTTP method '0' (Karen Etheridge)
45
567.00 2024-10-07 15:31:56Z
67 - Stop transforming LF into CRLF. Fixes #69 (GH#196) (Olaf Alders)
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ sub as_string
118118 my ($eol ) = @_ ;
119119 $eol = " \n " unless defined $eol ;
120120
121- my $req_line = $self -> method || " -" ;
121+ my $req_line = ( defined $self -> method) ? $self -> method : " -" ;
122122 my $uri = $self -> uri;
123123 $uri = (defined $uri ) ? $uri -> as_string : " -" ;
124124 $req_line .= " $uri " ;
@@ -131,7 +131,7 @@ sub as_string
131131sub dump
132132{
133133 my $self = shift ;
134- my @pre = ($self -> method || " -" , $self -> uri || " -" );
134+ my @pre = (( defined $self -> method) ? $self -> method : " -" , ( defined $self -> uri) ? $self -> uri : " -" );
135135 if (my $prot = $self -> protocol) {
136136 push (@pre , $prot );
137137 }
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use strict;
55use warnings;
66
77use Test::More;
8- plan tests => 39 ;
8+ plan tests => 42 ;
99
1010use HTTP::Request;
1111use Try::Tiny qw( catch try ) ;
@@ -166,3 +166,12 @@ $r2 = HTTP::Request->parse('methonly http://www.example.com/');
166166is( $r2 -> method, ' methonly' );
167167is( $r2 -> uri, ' http://www.example.com/' );
168168is( $r2 -> protocol, undef );
169+
170+ my $r3 = HTTP::Request-> new(0 => " http://www.example.com" );
171+ is($r3 -> method, ' 0' , ' 0 is a valid HTTP method' );
172+ is($r3 -> as_string, " 0 http://www.example.com\n\n " , ' parsed zero method req' );
173+ is($r3 -> dump , <<EOT , ' dumped zero method req' );
174+ 0 http://www.example.com
175+
176+ (no content)
177+ EOT
You can’t perform that action at this time.
0 commit comments