File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
10
10
## Unreleased
11
11
12
+ ## 1.8.5 - 2022-03-20
13
+
14
+ ### Fixed
15
+
16
+ - Correct header value validation
17
+
12
18
## 1.8.4 - 2022-03-20
13
19
14
20
### Fixed
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ private function assertValue($value)
263
263
// Clients must not send a request with line folding and a server sending folded headers is
264
264
// likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
265
265
// folding is not likely to break any legitimate use case.
266
- if (! preg_match ('/^(?:[\x21-\x7E\x80-\xFF](?:[\ x20\x09]+[ \x21-\x7E\x80-\xFF])?) *$/ ' , $ value )) {
266
+ if (! preg_match ('/^[\ x20\x09\x21-\x7E\x80-\xFF]*$/ ' , $ value )) {
267
267
throw new \InvalidArgumentException (sprintf ('"%s" is not valid header value ' , $ value ));
268
268
}
269
269
}
Original file line number Diff line number Diff line change @@ -174,6 +174,17 @@ public function testHostIsAddedFirst()
174
174
], $ r ->getHeaders ());
175
175
}
176
176
177
+ public function testHeaderValueWithWhitespace ()
178
+ {
179
+ $ r = new Request ('GET ' , 'https://example.com/ ' , [
180
+ 'User-Agent ' => 'Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64 '
181
+ ]);
182
+ self ::assertSame ([
183
+ 'Host ' => ['example.com ' ],
184
+ 'User-Agent ' => ['Linux f0f489981e90 5.10.104-linuxkit 1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64 ' ]
185
+ ], $ r ->getHeaders ());
186
+ }
187
+
177
188
public function testCanGetHeaderAsCsv ()
178
189
{
179
190
$ r = new Request ('GET ' , 'http://foo.com/baz?bar=bam ' , [
You can’t perform that action at this time.
0 commit comments