http - 为什么 HTTP 代理能够支持像 IRC 和 FTP 这样的协议(protocol)?

标签 http proxy protocols socks

我了解 SOCKS 代理仅在 TCP 级别建立连接,而 HTTP 代理在 HTTP 级别解释流量。因此,SOCKS 代理可以用于任何类型的协议(protocol),而 HTTP 代理只能处理 HTTP 流量。但是为什么像 Squid 这样的 HTTP Proxy 可以支持像 IRC,FTP 这样的协议(protocol)呢?当我们使用 HTTP 代理进行 IRC 或 FTP 连接时,具体会发生什么?通过 HTTP 协议(protocol)发送到代理时,是否有任何元数据添加到包中?

最佳答案

如果 HTTP 代理支持主要用于 HTTPS 连接的 CONNECT 方法,它就能够支持 HTTP 以外的高级协议(protocol),这里是来自 Squid wiki 的描述:

The CONNECT method is a way to tunnel any kind of connection through an HTTP proxy. By default, the proxy establishes a TCP connection to the specified server, responds with an HTTP 200 (Connection Established) response, and then shovels packets back and forth between the client and the server, without understanding or interpreting the tunnelled traffic

如果客户端软件支持通过启用“HTTP CONNECT”的 (HTTPS) 代理进行连接,它可以是任何可以与此类代理一起工作的高级协议(protocol)(VPN、SSH、SQL、版本控制等)

关于http - 为什么 HTTP 代理能够支持像 IRC 和 FTP 这样的协议(protocol)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12026247/

相关文章:

http - 当 Expect header 为空时,Tomcat7 拒绝 POSTS

http - 在开发 Web 应用程序时,您实际使用哪些 HTTP 状态代码?

.net - 处理代理自动配置脚本以在 .net 中进行网络服务调用的正确方法是什么?

ios - Swift 2 协议(protocol)扩展使用

javascript - 如何通过 JavaScript 访问 HTTP 请求 header 字段?

java - HTTP代理可以修改TCP Java字节流吗?

c# - 如何使动态生成的 .net 服务客户端从 *.config 文件以外的其他位置读取配置

javascript - 检测网站是否通过 Opera Mini 等代理服务器提供服务?

ios - init 的 Swift 协议(protocol)扩展自引用问题

ios - 如何使用协议(protocol)在两个 View Controller 之间传递值