Commit 7871b4c95a2a7ee4f98a7d7ba3ad9eb538c101f8

  • avatar
  • Gisle Aas (Committer)
  • Thu Sep 18 09:28:20 CEST 2008
  • avatar
  • Todd Lipcon <todd @amies…eet.com> (Author)
  • Thu Sep 18 09:28:20 CEST 2008
Fixed parsing of header values starting with ':' [RT#39367]
  
298298 my $line_count = 0;
299299 my $max_header_lines = ${*$self}{'http_max_header_lines'};
300300 while (my $line = my_readline($self)) {
301 if ($line =~ /^(\S+)\s*:\s*(.*)/s) {
301 if ($line =~ /^(\S+?)\s*:\s*(.*)/s) {
302302 push(@headers, $1, $2);
303303 }
304304 elsif (@headers && $line =~ s/^\s+//) {
  
11#!./perl -w
22
3print "1..15\n";
3print "1..16\n";
44
55use strict;
66#use Data::Dump ();
2020 "/09" => "Hello${CRLF}World!${CRLF}",
2121 "/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}",
2222 "/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",
2324 },
2425 );
2526
194194print "not " unless $res->{code} eq "200" && $res->{content} eq "TRACE / HTTP/1.0\r\n\r\n";
195195print "ok 14\n";
196196
197# check that headers with colons at the start of values don't break
198$res = $h->request(GET => '/colon-header');
199print "not " unless "@{$res->{headers}}" eq "Content-Type text/plain Content-Length 6 Bad-Header :foo";
200print "ok 15\n";
201
197202require Net::HTTP;
198203eval {
199204 $h = Net::HTTP->new;
200205};
201206print "# $@";
202207print "not " unless $@;
203print "ok 15\n";
208print "ok 16\n";