Skip to content

Commit

Permalink
Bug 5449 is a regression of Bug 4492!
Browse files Browse the repository at this point in the history
Both bugs deal with "chunk-size SP+ CRLF" use cases. Bug 4492 had _two_
spaces after chunk-size, which answers one of the PR review questions:
Should we skip just one space? No, we should not.

The lines moved around in many commits, but I believe this regression
was introduced in commit 951013d because that commit stopped consuming
partially parsed chunk-ext sequences. That consumption was wrong, but it
had a positive side effect -- fixing Bug 4492...
  • Loading branch information
rousskov committed Oct 11, 2024
1 parent 81e67f9 commit a0d4fe1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/http/one/TeChunkedParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ Http::One::TeChunkedParser::parseChunkMetadataSuffix(Tokenizer &tok)
// Code becomes much simpler when incremental parsing functions throw on
// bad or insufficient input, like in the code below. TODO: Expand up.
try {
// A possibly empty chunk-ext list. If no chunk-ext has been found,
// try to skip trailing BWS, because some servers send "chunk-size BWS CRLF".
if (!parseChunkExtensions(tok))
ParseBws(tok, true);
// Bug 4492: IBM_HTTP_Server sends SP after chunk-size
ParseBws(tok, true);

parseChunkExtensions(tok);

tok.skipRequired("CRLF after [chunk-ext]", Http1::CrLf());
buf_ = tok.remaining();
Expand All @@ -150,7 +150,7 @@ Http::One::TeChunkedParser::parseChunkExtensions(Tokenizer &callerTok)
do {
auto tok = callerTok;

ParseBws(tok); // Bug 4492: IBM_HTTP_Server sends SP after chunk-size
ParseBws(tok);

if (!tok.skip(';'))
return foundChunkExt; // reached the end of extensions (if any)
Expand Down

0 comments on commit a0d4fe1

Please sign in to comment.