Skip to content

Commit 968789d

Browse files
committed
Stop transforming LF into CRLF. Fixes #69
1 parent db28013 commit 968789d

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/HTTP/Request/Common.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ sub request_type_with_data
8787
my $url = URI->new('http:');
8888
$url->query_form(ref($content) eq "HASH" ? %$content : @$content);
8989
$content = $url->query;
90-
91-
# HTML/4.01 says that line breaks are represented as "CR LF" pairs (i.e., `%0D%0A')
92-
$content =~ s/(?<!%0D)%0A/%0D%0A/g if defined($content);
9390
}
9491
}
9592

t/common-req.t

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use strict;
22
use warnings;
33

44
use Test::More;
5-
plan tests => 71;
65

76
use File::Spec;
87
use File::Temp qw(tempfile);
@@ -86,9 +85,9 @@ note $r->as_string, "\n";
8685

8786
is($r->method, "POST");
8887
is($r->content_type, "application/x-www-form-urlencoded");
89-
is($r->content_length, 83);
90-
is($r->header("bar"), "foo");
91-
is($r->content, "foo=bar%3Bbaz&baz=a&baz=b&baz=c&foo=zoo%3D%26&space+=+%2B+&nl=a%0D%0Ab%0D%0Ac%0D%0A");
88+
is($r->content_length, 77, 'content_length');
89+
is($r->header("bar"), "foo", 'bar is foo');
90+
is($r->content, 'foo=bar%3Bbaz&baz=a&baz=b&baz=c&foo=zoo%3D%26&space+=+%2B+&nl=a%0Ab%0D%0Ac%0A');
9291

9392
$r = POST "http://example.com";
9493
is($r->content_length, 0);
@@ -184,7 +183,7 @@ like($r->content, qr/bar=24/);
184183
is($r->content_type, "application/x-www-form-urlencoded");
185184
is($r->content_length, 13);
186185

187-
186+
188187
#
189188
# POST for File upload
190189
#
@@ -273,3 +272,5 @@ $r = HTTP::Request::Common::PATCH 'http://www.example.com',
273272
'Content' => 'foobarbaz',
274273
'Content-Length' => 12; # a slight lie
275274
is($r->header('Content-Length'), 9);
275+
276+
done_testing();

0 commit comments

Comments
 (0)