URL 让我的 FTP 服务器作为 REST 方法参数
URL for my FTPs server to put as a REST method parameter
A REST API 有一个读取 URL 上存在的 .csv
文件的方法,并声称此 URL 可以是 public 地址或 FTP 服务器。
我已经成功地将文件上传到 FTPs 服务器,但这不是我的问题。我想知道的是,如果我的文件已经上传到具有以下属性的 FTPs 服务器
Host: 111.222.333.444
Port: XX
Username: myUserName
Password: myPassword
Working directory: /home/myFolder
File name: myFile.csv
URL 会是什么样子?
API接受的URL当然是字符串值。我读过 in this page 如果我将值写为
ftp://YourFtpUser%40YourDomain.com:YourFtpUserPassword@yourdomain.com
它会起作用的。但是在这个地址中替换我的值并没有让我到任何地方。我怎么知道要使用什么格式?
更新: 日志文件使用 WinSCP。我替换了真实身份值。
. 2015-11-27 14:09:17.664 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.664 WinSCP Version 5.7.6 (Build 5874) (OS 6.1.7601 Service Pack 1 - Windows 7 Enterprise)
. 2015-11-27 14:09:17.664 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2015-11-27 14:09:17.665 Log level: Normal
. 2015-11-27 14:09:17.665 Local account: ACTIONBASE\pedram.mobedi
. 2015-11-27 14:09:17.665 Working directory: C:\Program Files (x86)\WinSCP
. 2015-11-27 14:09:17.665 Process ID: 15780
. 2015-11-27 14:09:17.665 Command-line: winscp.exe "ftp://myUserName:myPassword@111.222.333.444:22/" /log=C:\mylog.log
. 2015-11-27 14:09:17.665 Time zone: Current: GMT+1, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 2015-03-29, DST End: 2015-10-25
. 2015-11-27 14:09:17.665 Login time: den 27 november 2015 14:09:17
. 2015-11-27 14:09:17.665 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.665 Session name: myUsername@111.222.333.444 (Ad-Hoc site)
. 2015-11-27 14:09:17.665 Host name: 111.222.333.444 (Port: 22)
. 2015-11-27 14:09:17.665 User name: myUsername (Password: Yes, Key file: No)
. 2015-11-27 14:09:17.665 Transfer Protocol: FTP
. 2015-11-27 14:09:17.665 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2015-11-27 14:09:17.665 Disable Nagle: No
. 2015-11-27 14:09:17.665 Proxy: none
. 2015-11-27 14:09:17.665 Send buffer: 262144
. 2015-11-27 14:09:17.665 UTF: 2
. 2015-11-27 14:09:17.665 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2015-11-27 14:09:17.665 Local directory: default, Remote directory: /home/myUsername/pedramtest/, Update: Yes, Cache: Yes
. 2015-11-27 14:09:17.665 Cache directory changes: Yes, Permanent: Yes
. 2015-11-27 14:09:17.665 Timezone offset: 0h 0m
. 2015-11-27 14:09:17.665 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.734 Connecting to 111.222.333.444:22 ...
. 2015-11-27 14:09:17.734 Connected with 111.222.333.444:22. Waiting for welcome message...
< 2015-11-27 14:09:17.734 SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
. 2015-11-27 14:09:32.870 Timeout detected. (control connection)
. 2015-11-27 14:09:32.870 Connection failed.
* 2015-11-27 14:09:32.901 (EFatal) Connection failed.
* 2015-11-27 14:09:32.901 Timeout detected. (control connection)
* 2015-11-27 14:09:32.901 Connection failed.
我们不知道您的 REST API,因此我们无法知道它支持的格式。
无论如何,假设 API 遵循标准 (RFC 1738),URL 格式将是:
ftp://myUserName:myPassword@111.222.333.444:XX/home/myFolder/myFile.csv
据我所知,FTPS 没有标准。虽然 ftps://
通常用于隐式 TLS/SSL 连接上的 FTP。很少有客户端支持 ftpes://
显式 TLS/SSL.
如果端口号是 21(或隐含的 TLS/SSL 为 990),您可以省略 :XX
。
关于您对 WinSCP 的尝试:
- 您使用
ftp://
,而不是 ftps://
,因此显然尝试了未加密的 FTP 连接。
- 反正服务器不是FTP也不是FTPS,而是SFTP(SSH)。您可以通过“SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2”横幅而不是 FTP 欢迎消息来判断。 SFTP 是与 FTPS 完全不同的协议。
参见 Differences between SFTP and "FTP over SSH" 或
Is "SFTP" and "FTP over SSL" a same thing?
A REST API 有一个读取 URL 上存在的 .csv
文件的方法,并声称此 URL 可以是 public 地址或 FTP 服务器。
我已经成功地将文件上传到 FTPs 服务器,但这不是我的问题。我想知道的是,如果我的文件已经上传到具有以下属性的 FTPs 服务器
Host: 111.222.333.444
Port: XX
Username: myUserName
Password: myPassword
Working directory: /home/myFolder
File name: myFile.csv
URL 会是什么样子?
API接受的URL当然是字符串值。我读过 in this page 如果我将值写为
ftp://YourFtpUser%40YourDomain.com:YourFtpUserPassword@yourdomain.com
它会起作用的。但是在这个地址中替换我的值并没有让我到任何地方。我怎么知道要使用什么格式?
更新: 日志文件使用 WinSCP。我替换了真实身份值。
. 2015-11-27 14:09:17.664 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.664 WinSCP Version 5.7.6 (Build 5874) (OS 6.1.7601 Service Pack 1 - Windows 7 Enterprise)
. 2015-11-27 14:09:17.664 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2015-11-27 14:09:17.665 Log level: Normal
. 2015-11-27 14:09:17.665 Local account: ACTIONBASE\pedram.mobedi
. 2015-11-27 14:09:17.665 Working directory: C:\Program Files (x86)\WinSCP
. 2015-11-27 14:09:17.665 Process ID: 15780
. 2015-11-27 14:09:17.665 Command-line: winscp.exe "ftp://myUserName:myPassword@111.222.333.444:22/" /log=C:\mylog.log
. 2015-11-27 14:09:17.665 Time zone: Current: GMT+1, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 2015-03-29, DST End: 2015-10-25
. 2015-11-27 14:09:17.665 Login time: den 27 november 2015 14:09:17
. 2015-11-27 14:09:17.665 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.665 Session name: myUsername@111.222.333.444 (Ad-Hoc site)
. 2015-11-27 14:09:17.665 Host name: 111.222.333.444 (Port: 22)
. 2015-11-27 14:09:17.665 User name: myUsername (Password: Yes, Key file: No)
. 2015-11-27 14:09:17.665 Transfer Protocol: FTP
. 2015-11-27 14:09:17.665 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2015-11-27 14:09:17.665 Disable Nagle: No
. 2015-11-27 14:09:17.665 Proxy: none
. 2015-11-27 14:09:17.665 Send buffer: 262144
. 2015-11-27 14:09:17.665 UTF: 2
. 2015-11-27 14:09:17.665 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2015-11-27 14:09:17.665 Local directory: default, Remote directory: /home/myUsername/pedramtest/, Update: Yes, Cache: Yes
. 2015-11-27 14:09:17.665 Cache directory changes: Yes, Permanent: Yes
. 2015-11-27 14:09:17.665 Timezone offset: 0h 0m
. 2015-11-27 14:09:17.665 --------------------------------------------------------------------------
. 2015-11-27 14:09:17.734 Connecting to 111.222.333.444:22 ...
. 2015-11-27 14:09:17.734 Connected with 111.222.333.444:22. Waiting for welcome message...
< 2015-11-27 14:09:17.734 SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
. 2015-11-27 14:09:32.870 Timeout detected. (control connection)
. 2015-11-27 14:09:32.870 Connection failed.
* 2015-11-27 14:09:32.901 (EFatal) Connection failed.
* 2015-11-27 14:09:32.901 Timeout detected. (control connection)
* 2015-11-27 14:09:32.901 Connection failed.
我们不知道您的 REST API,因此我们无法知道它支持的格式。
无论如何,假设 API 遵循标准 (RFC 1738),URL 格式将是:
ftp://myUserName:myPassword@111.222.333.444:XX/home/myFolder/myFile.csv
据我所知,FTPS 没有标准。虽然 ftps://
通常用于隐式 TLS/SSL 连接上的 FTP。很少有客户端支持 ftpes://
显式 TLS/SSL.
如果端口号是 21(或隐含的 TLS/SSL 为 990),您可以省略 :XX
。
关于您对 WinSCP 的尝试:
- 您使用
ftp://
,而不是ftps://
,因此显然尝试了未加密的 FTP 连接。 - 反正服务器不是FTP也不是FTPS,而是SFTP(SSH)。您可以通过“SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2”横幅而不是 FTP 欢迎消息来判断。 SFTP 是与 FTPS 完全不同的协议。
参见 Differences between SFTP and "FTP over SSH" 或
Is "SFTP" and "FTP over SSL" a same thing?