[英]How request CONNECT with Apache HttpComponents Client
Apache says:阿帕奇 说:
"HttpComponents Client is a successor of and replacement for Commons HttpClient 3.x. Users of Commons HttpClient are strongly encouraged to upgrade." “HttpComponents Client 是 Commons HttpClient 3.x 的继承者和替代品。强烈建议 Commons HttpClient 的用户升级。”
In package org.apache.http.client.methods almost all Http methods are supported:在org.apache.http.client.methods包中,几乎支持所有 Http 方法:
But what is with the method CONNECT?但是 CONNECT 方法是什么? How to execute a CONNECT request?如何执行 CONNECT 请求?
("Before" in org.apache.commons.httpclient there exist the ConnectMethod for method CONNECT.) ( org.apache.commons.httpclient 中的“之前”存在方法 CONNECT 的 ConnectMethod。)
One can easily create a CONNECT request but I am not entirely sure what you intent to do with it可以轻松创建 CONNECT 请求,但我不完全确定您打算用它做什么
HttpRequest connect = new BasicHttpRequest("CONNECT", "somehost:80");
HttpClient creates CONNECT requests internally when establishing an SSL tunnel through a proxy server.当通过代理服务器建立 SSL 隧道时,HttpClient 在内部创建 CONNECT 请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.