Repository navigation
Keep the control connection open after a 501 reply - #607
Open
G26karthik wants to merge 1 commit into
Open
G26karthik wants to merge 1 commit into
G26karthik wants to merge 1 commit into
Conversation
FtpCodec::decode returned line parser errors as decoder errors. Framed ends the stream after a decoder error, so the control loop saw the connection as closed after sending the 501. Return the parse result as the item instead and let handle_control_channel_error decide whether to close.
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.
When a command parameter fails to parse, the server replies
501 Invalid Parameterand then closes the control connection. For example, afterREST abcthe nextNOOPfails because the connection is gone.handle_control_channel_errormapsInvalidCommandto 501 withclose_connection = false, so the session is meant to stay open.The cause is
FtpCodec::decodereturning the line parser's error as the decoder error. tokio-util'sFramedends the stream after a decoder error (the next poll returnsNone), and the control loop reads thatNoneas the client closing the connection.decodenow returns the parse result as the item (Item = Result<Command, ControlChanError>) and the control loop flattens it, sohandle_control_channel_errordecides whether to close, as it already does for other errors. I/O errors from the socket still come through the outerResult.tests/invalid_parameter.rssendsREST abcand thenNOOPover a real control connection, using the shared server fromtests/common.rs. It fails on master (connection aborted on theNOOPread) and passes with the change.