Commit f92e056
authored
Only treat space and \t as allowed whitespace in headers
RFC 7230 (HTTP RFC) Section 3.2.3 is clear that those are
the only two allowed characters for required/optional
whitespace in headers.
RFC 2046 (MIME/Multipart RFC) refers to RFC 822, and RFC
822 Section 3.3 also specifies that linear white space
is made up of only space and tab characters.
While here, I noticed the content-type parser in the multipart
code was requiring a space, when whitespace is optional.
Make the whitespace optional, and adjust a test where a
content-type was ignored because it didn't use whitespace.
The request and utils changes here are operating on header
values, and generally other whitespace is allowed there, but
I'm not sure we should split on whitespace other than space
and \t, so I made the change there as well.
There are a lot of places in Rack where we are using
strip/strip! were we should potentially change to be more
strict and only strip space and \t, but this commit does not
attempt to address strip/strip! usage.1 parent 4af2d21 commit f92e056
File tree
4 files changed
+5
-5
lines changed- lib/rack
- multipart
- test
4 files changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
| 664 | + | |
665 | 665 | | |
666 | 666 | | |
667 | 667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| |||
0 commit comments