使用 HTTP 代理上传 FTP 文件 [英] FTP File Upload with HTTP Proxy

查看:55
本文介绍了使用 HTTP 代理上传 FTP 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 HTTP 代理后面将文件上传到 FTP 服务器?

Is there a way to upload a file to a FTP server when behind an HTTP proxy ?

使用 .Net Webclient 的 HTTP 代理似乎不支持上传文件.(http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.proxy.aspx).

It seems that uploading a file is not supported behind an HTTP Proxy using .Net Webclient. (http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.proxy.aspx).

如果没有解决方法?如果没有,你知道我可以使用的一个好的免费 FTP 库吗?

If there is no workaround ? If not, do you know a good and free FTP library I can use ?

编辑:很遗憾,我没有任何 FTP 代理可以连接.

Edit: Unfortunately, I don't have any FTP proxy to connect to.

推荐答案

在主动 FTP 模式下,服务器向客户端发起数据连接.如果客户端位于 HTTP 代理之后,这显然不起作用.在被动 FTP 模式下,客户端启动初始连接和数据连接.由于 HTTP 代理可以建立任意传出 TCP 连接的隧道(使用 CONNECT 方法),因此应该可以通过 HTTP 代理以被动模式访问 FTP 服务器.

In active FTP mode, the server initiates a data connection to the client. If the client is behind an HTTP proxy, this obviously won't work. In passive FTP mode it is the client who initiates both the initial and the data connections. Since HTTP proxies can tunnel arbitrary outgoing TCP connections (using the CONNECT method), it should be possible to access an FTP server in passive mode via an HTTP proxy.

FtpWebRequest 似乎支持被动模式.但是,我不明白为什么支持文件下载和目录列表,而不支持同样使用相同数据连接的文件上传.

The FtpWebRequest seems to support passive mode. However, I don't understand why file download and directory listings are supported, whereas file upload, which also uses the same data connection, is not.

您是否确认为被动模式配置的 FtpWebRequest 无法通过 HTTP 代理运行,目录列表/文件下载通过该代理正常工作?

Have you confirmed that FtpWebRequest configured for passive mode does not work via an HTTP proxy through which directory listings/file download work just fine?

这篇关于使用 HTTP 代理上传 FTP 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆