Skip to content

Commit

Permalink
Adding support for BYE command (#453)
Browse files Browse the repository at this point in the history
Should support this command as an alias of `QUIT`, some clients would
use this command
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ftp-bye
  • Loading branch information
Phosphorus15 authored Mar 19, 2023
1 parent 469aa36 commit ef8a27b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/controlchan/line_parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ where
let path = String::from_utf8_lossy(&path).to_string();
Command::Rmd { path }
}
"QUIT" => {
"QUIT" | "BYE" => {
let params = parse_to_eol(cmd_params)?;
if !params.is_empty() {
return Err(ParseErrorKind::InvalidCommand.into());
Expand Down
9 changes: 9 additions & 0 deletions src/server/controlchan/line_parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ fn parse_quit() {
assert_eq!(parse(input), Err(ParseError::from(ParseErrorKind::InvalidCommand)));
}

#[test]
fn parse_bye() {
let input = "BYE\r\n";
assert_eq!(parse(input), Ok(Command::Quit));

let input = "BYE BYE\r\n";
assert_eq!(parse(input), Err(ParseError::from(ParseErrorKind::InvalidCommand)));
}

#[test]
fn parse_mkd() {
let input = "MKD\r\n";
Expand Down

0 comments on commit ef8a27b

Please sign in to comment.