support for local address in operator
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@509294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9a201ac17b
commit
688e6017b4
|
@ -104,7 +104,7 @@ public class OperatorConnectDirect {
|
|||
HttpContext ctx = createContext();
|
||||
|
||||
System.out.println("opening connection to " + target);
|
||||
scop.openConnection(conn, target, ctx, getParams());
|
||||
scop.openConnection(conn, target, null, ctx, getParams());
|
||||
|
||||
System.out.println("sending request");
|
||||
conn.sendRequestHeader(req);
|
||||
|
|
|
@ -109,7 +109,7 @@ public class OperatorConnectProxy {
|
|||
HttpContext ctx = createContext();
|
||||
|
||||
System.out.println("opening connection to " + proxy);
|
||||
scop.openConnection(conn, proxy, ctx, getParams());
|
||||
scop.openConnection(conn, proxy, null, ctx, getParams());
|
||||
|
||||
HttpRequest connect = createConnect(target);
|
||||
System.out.println("opening tunnel to " + target);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.apache.http.conn;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
@ -75,6 +76,8 @@ public interface ClientConnectionOperator {
|
|||
*
|
||||
* @param conn the connection to open
|
||||
* @param target the target host to connect to
|
||||
* @param local the local address to route from, or
|
||||
* <code>null</code> for the default
|
||||
* @param context the context for the connection
|
||||
* @param params the parameters for the connection
|
||||
*
|
||||
|
@ -82,6 +85,7 @@ public interface ClientConnectionOperator {
|
|||
*/
|
||||
void openConnection(OperatedClientConnection conn,
|
||||
HttpHost target,
|
||||
InetAddress local,
|
||||
HttpContext context,
|
||||
HttpParams params)
|
||||
throws IOException
|
||||
|
|
|
@ -99,6 +99,7 @@ public class DefaultClientConnectionOperator
|
|||
// non-javadoc, see interface ClientConnectionOperator
|
||||
public void openConnection(OperatedClientConnection conn,
|
||||
HttpHost target,
|
||||
InetAddress local,
|
||||
HttpContext context,
|
||||
HttpParams params)
|
||||
throws IOException {
|
||||
|
@ -111,6 +112,7 @@ public class DefaultClientConnectionOperator
|
|||
throw new IllegalArgumentException
|
||||
("Target host must not be null.");
|
||||
}
|
||||
// local address may be null
|
||||
//@@@ is context allowed to be null?
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException
|
||||
|
@ -121,9 +123,6 @@ public class DefaultClientConnectionOperator
|
|||
("Connection must not be open.");
|
||||
}
|
||||
|
||||
InetAddress local = null;
|
||||
//@@@ TODO: deal with local address stuff (from context?)
|
||||
|
||||
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
|
||||
if (schm == null) {
|
||||
throw new IllegalArgumentException
|
||||
|
|
|
@ -1183,6 +1183,7 @@ public class ThreadSafeClientConnManager
|
|||
ThreadSafeClientConnManager.this.connOperator.openConnection
|
||||
(this.connection,
|
||||
(proxy != null) ? proxy : route.getTargetHost(),
|
||||
route.getLocalAddress(),
|
||||
context, params);
|
||||
|
||||
if (proxy == null)
|
||||
|
|
Loading…
Reference in New Issue