Skip to content

Commit ce4a08f

Browse files
Catch case of empty name/value in header words split. (#168)
* Catch case of empty name/value in header words split. * Add test for bare = case.
1 parent b8a00e5 commit ce4a08f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/HTTP/Headers/Util.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ sub _split_header_words
5050
push(@res, [@cur]) if @cur;
5151
@cur = ();
5252
}
53-
elsif (s/^\s*;// || s/^\s+//) {
53+
elsif (s/^\s*;// || s/^\s+// || s/^=//) {
5454
# continue
5555
}
5656
else {

t/headers-util.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ my @s_tests = (
2828
'basic; realm="\"foo\\\\bar\""'],
2929
);
3030

31-
plan tests => @s_tests + 3;
31+
plan tests => @s_tests + 4;
3232

3333
for (@s_tests) {
3434
my($arg, $expect) = @$_;
@@ -44,3 +44,5 @@ note "# Extra tests\n";
4444
is(join_header_words("foo" => undef, "bar" => "baz"), "foo; bar=baz");
4545
is(join_header_words(), "");
4646
is(join_header_words([]), "");
47+
# ignore bare =
48+
is_deeply(split_header_words("foo; =;bar=baz"), ["foo" => undef, "bar" => "baz"]);

0 commit comments

Comments
 (0)