From a0d4fe1794e605f8299a5c118c758a807453f016 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Thu, 10 Oct 2024 22:39:42 -0400 Subject: [PATCH] Bug 5449 is a regression of Bug 4492! 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 951013d0 because that commit stopped consuming partially parsed chunk-ext sequences. That consumption was wrong, but it had a positive side effect -- fixing Bug 4492... --- src/http/one/TeChunkedParser.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/http/one/TeChunkedParser.cc b/src/http/one/TeChunkedParser.cc index 41e1e5ddaea..aa4a840fdcf 100644 --- a/src/http/one/TeChunkedParser.cc +++ b/src/http/one/TeChunkedParser.cc @@ -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(); @@ -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)