-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
When cpp-httplib receives a request with a header name containing spaces, it allows the spaces to persist into the header name. This is invalid, because spaces are not permitted in header names.
This can be confirmed by
- running a cpp-httplib server that echos header names (like this one),
- sending it a request with spaces in a header name, and extracting the echoed header name:
printf 'GET / HTTP/1.1\r\n Test: whatever\r\nHost: whatever\r\n\r\n' \
| timeout 1 ncat --no-shutdown localhost 80 \
| grep headers \
| jq '.["headers"][1][0]' \
| xargs echo \
| base64 -d \
| xxd
00000000: 2020 5465 7374 Test
Note that the spaces are still there in the header name.
The correct behavior in this scenario is to reject the request with a 400.
Metadata
Metadata
Assignees
Labels
No labels