Skip to content

Commit cd8038b

Browse files
committed
normalize newlines in forms to CRLF
HTTP::Message < 7.00 normalized newlines in requests to CRLF. This has been removed. Based on the [HTML spec](https://html.spec.whatwg.org/#converting-an-entry-list-to-a-list-of-name-value-pairs) and [URL spec](https://url.spec.whatwg.org/#urlencoded-serializing), the CRLF normalization should be in the HTML layer. So the change in HTTP::Message is correct, and HTML::Form should be handling the normalization. Add normalization of lone \r or \n into \r\n, as defined in the HTML spec.
1 parent cf9ebcc commit cd8038b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/HTML/Form/Input.pm

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ sub form_name_value {
113113
return if $self->disabled;
114114
my $value = $self->value;
115115
return unless defined $value;
116+
s/\x0d?\x0a|\x0d/\x0d\x0a/g
117+
for $name, $value;
116118
return ( $name => $value );
117119
}
118120

0 commit comments

Comments
 (0)