Honor reply_header_max_size for received FTP control responses#2417
Open
somecookie wants to merge 19 commits intosquid-cache:masterfrom
Open
Honor reply_header_max_size for received FTP control responses#2417somecookie wants to merge 19 commits intosquid-cache:masterfrom
somecookie wants to merge 19 commits intosquid-cache:masterfrom
Conversation
…ode for comm_read
Co-authored-by: Alex Rousskov <rousskov@measurement-factory.com>
Co-authored-by: Alex Rousskov <rousskov@measurement-factory.com>
maxSize is reply_header_max_size today, but let's not imply that the two are guaranteed to match across future type changes.
rousskov
approved these changes
May 5, 2026
Contributor
rousskov
left a comment
There was a problem hiding this comment.
FWIW, we are working on addressing two more FTP problems.
| commUnsetConnTimeout(data.conn); | ||
| } | ||
|
|
||
| const auto maxSize = min(Config.maxReplyHeaderSize, std::numeric_limits<decltype(ctrl.size)>::max()); |
Contributor
There was a problem hiding this comment.
Today, maxSize is always Config.maxReplyHeaderSize (i.e. reply_header_max_size) because the two variables use the same size_t type. Tomorrow, PR code should continue to work correctly even if type(s) change.
Alternatively, we could statically assert that the types are the same and remove this min() call. IMHO, the solution proposed by this PR is slightly better even though it requires adding min(). Thus, I am not requesting any related changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2023 commit 801593a claimed that
reply_header_max_sizeapplied to "FTPcommand responses". However, that misleading claim probably only covered
FTP command replies that were parsed while being loaded from cache1,
after being converted to HttpReply objects and written to Store. The
same claim now applies to all received/raw FTP command replies as well.
This is a Measurement Factory project.
Footnotes
Both store_client::parseHttpHeadersFromDisk() and
MemStore::copyFromShm() called HttpReply::parseTerminatedPrefix(). ↩