Skip to content

Honor reply_header_max_size for received FTP control responses#2417

Open
somecookie wants to merge 19 commits intosquid-cache:masterfrom
measurement-factory:osd-6-limit-ftp-control-responses
Open

Honor reply_header_max_size for received FTP control responses#2417
somecookie wants to merge 19 commits intosquid-cache:masterfrom
measurement-factory:osd-6-limit-ftp-control-responses

Conversation

@somecookie
Copy link
Copy Markdown
Contributor

2023 commit 801593a claimed that reply_header_max_size applied to "FTP
command 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

  1. Both store_client::parseHttpHeadersFromDisk() and
    MemStore::copyFromShm() called HttpReply::parseTerminatedPrefix().

Copy link
Copy Markdown
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we are working on addressing two more FTP problems.

Comment thread src/clients/FtpClient.cc
commUnsetConnTimeout(data.conn);
}

const auto maxSize = min(Config.maxReplyHeaderSize, std::numeric_limits<decltype(ctrl.size)>::max());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rousskov rousskov added the S-could-use-an-approval An approval may speed this PR merger (but is not required) label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-could-use-an-approval An approval may speed this PR merger (but is not required)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants