Propagate FTP preflight cancellation
This commit is contained in:
@@ -13,6 +13,7 @@ const LISTING: &[u8] = b"type=file;size=3; report.md \r\n";
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Scenario {
|
||||
CancelledPreflight,
|
||||
ExpiredListing,
|
||||
LostMutationReply,
|
||||
}
|
||||
@@ -142,6 +143,9 @@ impl Tcp {
|
||||
state.listings += 1;
|
||||
"150 Listing\r\n226 Complete\r\n"
|
||||
}
|
||||
"NOOP" if matches!(state.scenario, Scenario::CancelledPreflight) => {
|
||||
return Err(HostError::Cancelled);
|
||||
}
|
||||
"NOOP"
|
||||
if index == 0
|
||||
&& (matches!(state.scenario, Scenario::LostMutationReply)
|
||||
@@ -157,6 +161,13 @@ impl Tcp {
|
||||
state.mkdir_commands += 1;
|
||||
return Ok(bytes.len() as u32);
|
||||
}
|
||||
"MKD /cancelled"
|
||||
if index == 1
|
||||
&& matches!(state.scenario, Scenario::CancelledPreflight) =>
|
||||
{
|
||||
state.mkdir_commands += 1;
|
||||
return Err(HostError::Unavailable);
|
||||
}
|
||||
_ => return Err(HostError::InvalidInput),
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user