mirror of
https://github.com/vlang/v.git
synced 2025-09-08 06:41:58 -04:00
breaking,net.ftp: allow to choose a different port than port 21 (change FTP.connect to accept host:port
, not just a host
address) (#21185)
This commit is contained in:
parent
2c646bfadd
commit
38b3115a9c
@ -100,9 +100,9 @@ fn (mut zftp FTP) read() !(int, string) {
|
||||
return code, data
|
||||
}
|
||||
|
||||
// connect establishes an FTP connection to the host at `ip` port 21.
|
||||
pub fn (mut zftp FTP) connect(ip string) !bool {
|
||||
zftp.conn = net.dial_tcp('${ip}:21')!
|
||||
// connect establishes an FTP connection to the host at `oaddress` (ip:port).
|
||||
pub fn (mut zftp FTP) connect(oaddress string) !bool {
|
||||
zftp.conn = net.dial_tcp(oaddress)!
|
||||
zftp.reader = io.new_buffered_reader(reader: zftp.conn)
|
||||
code, _ := zftp.read()!
|
||||
if code == ftp.connected {
|
||||
|
@ -17,7 +17,7 @@ fn ftp_client_test_inside() ! {
|
||||
defer {
|
||||
zftp.close() or { panic(err) }
|
||||
}
|
||||
connect_result := zftp.connect('ftp.redhat.com')!
|
||||
connect_result := zftp.connect('ftp.redhat.com:21')!
|
||||
assert connect_result
|
||||
login_result := zftp.login('ftp', 'ftp')!
|
||||
assert login_result
|
||||
|
Loading…
x
Reference in New Issue
Block a user