-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] - Active mode commands timeout #72
Comments
Mhm, I have tried with the suppaftp-cli binary and it connects and works fine in passive mode. I have an active mode failure, when listing files:
Maybe your timeout is caused by the failure to bind on the local address? Try to enable trace log and check if it prints some more information. |
Thanks. In my test with suppaftp-cli, I get the following.
The following Python script works with the same host and the same local machine. import ftplib
conn=ftplib.FTP(host="ftp.ncbi.nih.gov", user="anonymous", passwd="")
filenames = conn.nlst()
print(filenames) Output
Since the same host and the local machine were tested, it seems that cuppa-ftp and ftplib do something different? |
at this point it times out even in passive mode, so the problem is probably unrelated to active mode. |
With cuppa-ftp, cwd and pwd worked.
fn main() -> suppaftp::FtpResult<()> {
let parent_url = "ftp.ncbi.nih.gov:21";
let mut ftp_stream = suppaftp::FtpStream::connect(parent_url).unwrap();
ftp_stream.login("anonymous", "").unwrap();
ftp_stream.cwd("/snp/latest_release").unwrap();
println!("Current directory is {}.", ftp_stream.pwd().unwrap());
let mut buf: Vec<u8> = Vec::new();
let r = ftp_stream.retr("release_notes.txt", |stream| {
println!("stream={:#?}", stream.read_to_end(&mut buf));
Ok(())
}).map_err(|e| {
e
});
println!("r={:#?}", r);
let _ = ftp_stream.quit();
Ok(())
}
fn main() -> suppaftp::FtpResult<()> {
let parent_url = "ftp.ncbi.nih.gov:21";
let ftp_stream = suppaftp::FtpStream::connect(parent_url).unwrap();
let mut ftp_stream = ftp_stream.active_mode(std::time::Duration::new(60, 0));
ftp_stream.login("anonymous", "").unwrap();
ftp_stream.cwd("/snp/latest_release").unwrap();
println!("Current directory is {}.", ftp_stream.pwd().unwrap());
let mut buf: Vec<u8> = Vec::new();
let r = ftp_stream.retr("release_notes.txt", |stream| {
println!("stream={:#?}", stream.read_to_end(&mut buf));
Ok(())
}).map_err(|e| {
e
});
println!("r={:#?}", r);
let _ = ftp_stream.quit();
Ok(())
}
fn main() -> suppaftp::FtpResult<()> {
let parent_url = "ftp.ncbi.nih.gov:21";
let mut ftp_stream = suppaftp::FtpStream::connect(parent_url).unwrap();
ftp_stream.login("anonymous", "").unwrap();
ftp_stream.cwd("/snp/latest_release").unwrap();
println!("Current directory is {}.", ftp_stream.pwd().unwrap());
let r = ftp_stream.list(None);
match r {
Ok(_) => {
println!("r={:#?}", r);
},
Err(suppaftp::FtpError::UnexpectedResponse(v)) => {
let msg = std::str::from_utf8(&v.body).unwrap();
println!("Error: {}", msg);
},
_ => {
println!("r={:#?}", r);
}
}
let _ = ftp_stream.quit();
Ok(())
}
fn main() -> suppaftp::FtpResult<()> {
let parent_url = "ftp.ncbi.nih.gov:21";
let ftp_stream = suppaftp::FtpStream::connect(parent_url).unwrap();
let mut ftp_stream = ftp_stream.active_mode(std::time::Duration::new(60, 0));
ftp_stream.login("anonymous", "").unwrap();
ftp_stream.cwd("/snp/latest_release").unwrap();
println!("Current directory is {}.", ftp_stream.pwd().unwrap());
let r = ftp_stream.list(None);
match r {
Ok(_) => {
println!("r={:#?}", r);
},
Err(suppaftp::FtpError::UnexpectedResponse(v)) => {
let msg = std::str::from_utf8(&v.body).unwrap();
println!("Error: {}", msg);
},
_ => {
println!("r={:#?}", r);
}
}
let _ = ftp_stream.quit();
Ok(())
}
A Python script with which cwd, pwd, list, and retr worked is below. import ftplib
conn=ftplib.FTP(host="ftp.ncbi.nih.gov", user="anonymous", passwd="")
conn.cwd("/snp/latest_release")
print(f"pwd={conn.pwd()}")
filenames = conn.nlst()
print(f"files={filenames}")
lines = conn.retrlines("RETR release_notes.txt", store_retr_line)
print(f"lines={lines}") This specific FTP server has a readme: https://ftp.ncbi.nlm.nih.gov/README.ftp.
fn main() -> suppaftp::FtpResult<()> {
let parent_url = "ftp.cs.brown.edu:21";
let mut ftp_stream = suppaftp::FtpStream::connect(parent_url).unwrap();
ftp_stream.login("anonymous", "").unwrap();
ftp_stream.cwd("/").unwrap();
println!("Current directory is {}.", ftp_stream.pwd().unwrap());
let r = ftp_stream.list(None);
match r {
Ok(_) => {
println!("r={:#?}", r);
},
Err(suppaftp::FtpError::UnexpectedResponse(v)) => {
let msg = std::str::from_utf8(&v.body).unwrap();
println!("Error: {}", msg);
},
_ => {
println!("r={:#?}", r);
}
}
let _ = ftp_stream.quit();
Ok(())
}
|
Description
ftp.ncbi.nih.gov uses active mode.
list
command after login times out.Steps to reproduce
Expected behaviour
filenames_r
being a Vec of filenamesEnvironment
Additional information
N/A
The text was updated successfully, but these errors were encountered: