Skip to content

Commit addac0b

Browse files
committed
Disallow duplicated Host headers
1 parent cca5a35 commit addac0b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/HttpParser.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,12 @@ struct HttpParser {
501501
/* Add all headers to bloom filter */
502502
req->bf.reset();
503503
for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
504+
if (req->bf.mightHave(h->key)) [[unlikely]] {
505+
/* Host header is not allowed twice */
506+
if (h->key == "host" && req->getHeader("host").data()) {
507+
return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
508+
}
509+
}
504510
req->bf.add(h->key);
505511
}
506512

0 commit comments

Comments
 (0)