Commit 7871b4c95a2a7ee4f98a7d7ba3ad9eb538c101f8
- Diff rendering mode:
- inline
- side by side
lib/Net/HTTP/Methods.pm
(1 / 1)
|   | |||
| 298 | 298 | my $line_count = 0; | |
| 299 | 299 | my $max_header_lines = ${*$self}{'http_max_header_lines'}; | |
| 300 | 300 | while (my $line = my_readline($self)) { | |
| 301 | if ($line =~ /^(\S+)\s*:\s*(.*)/s) { | ||
| 301 | if ($line =~ /^(\S+?)\s*:\s*(.*)/s) { | ||
| 302 | 302 | push(@headers, $1, $2); | |
| 303 | 303 | } | |
| 304 | 304 | elsif (@headers && $line =~ s/^\s+//) { |
t/base/http.t
(8 / 2)
|   | |||
| 1 | 1 | #!./perl -w | |
| 2 | 2 | ||
| 3 | print "1..15\n"; | ||
| 3 | print "1..16\n"; | ||
| 4 | 4 | ||
| 5 | 5 | use strict; | |
| 6 | 6 | #use Data::Dump (); | |
| … | … | ||
| 20 | 20 | "/09" => "Hello${CRLF}World!${CRLF}", | |
| 21 | 21 | "/chunked" => "HTTP/1.1 200 OK${CRLF}Transfer-Encoding: chunked${CRLF}${CRLF}0002; foo=3; bar${CRLF}He${CRLF}1${CRLF}l${CRLF}2${CRLF}lo${CRLF}0000${CRLF}Content-MD5: xxx${CRLF}${CRLF}", | |
| 22 | 22 | "/head" => "HTTP/1.1 200 OK${CRLF}Content-Length: 16${CRLF}Content-Type: text/plain${CRLF}${CRLF}", | |
| 23 | "/colon-header" => "HTTP/1.1 200 OK${CRLF}Content-Type: text/plain${CRLF}Content-Length: 6${CRLF}Bad-Header: :foo${CRLF}${CRLF}Hello\n", | ||
| 23 | 24 | }, | |
| 24 | 25 | ); | |
| 25 | 26 | ||
| … | … | ||
| 194 | 194 | print "not " unless $res->{code} eq "200" && $res->{content} eq "TRACE / HTTP/1.0\r\n\r\n"; | |
| 195 | 195 | print "ok 14\n"; | |
| 196 | 196 | ||
| 197 | # check that headers with colons at the start of values don't break | ||
| 198 | $res = $h->request(GET => '/colon-header'); | ||
| 199 | print "not " unless "@{$res->{headers}}" eq "Content-Type text/plain Content-Length 6 Bad-Header :foo"; | ||
| 200 | print "ok 15\n"; | ||
| 201 | |||
| 197 | 202 | require Net::HTTP; | |
| 198 | 203 | eval { | |
| 199 | 204 | $h = Net::HTTP->new; | |
| 200 | 205 | }; | |
| 201 | 206 | print "# $@"; | |
| 202 | 207 | print "not " unless $@; | |
| 203 | print "ok 15\n"; | ||
| 208 | print "ok 16\n"; |

