private String hostHeader(Request request, Uri uri) { String virtualHost = request.getVirtualHost(); if (virtualHost != null) return virtualHost; else { String host = uri.getHost(); int port = uri.getPort(); return port == -1 || port == getSchemeDefaultPort(uri.getScheme()) ? host : host + ":" + port; } }
if (proxyServer != null) host = proxyServer.getHost(); else if (request.getVirtualHost() != null) host = request.getVirtualHost(); else host = uri.getHost();
String method = request.getMethod(); if (request.getVirtualHost() != null) { host = request.getVirtualHost(); if (uri.getPort() == -1 || request.getVirtualHost() != null) { urlConnection.setRequestProperty("Host", host); } else {
private void addHostHeaderIfNeeded(final Request request, final Uri uri, final HttpRequestPacket requestPacket) { if (!requestPacket.containsHeader(Header.Host)) { String host = request.getVirtualHost(); if (host != null) { requestPacket.addHeader(Header.Host, host); } else { if (uri.getPort() == -1) { requestPacket.addHeader(Header.Host, uri.getHost()); } else { requestPacket.addHeader(Header.Host, uri.getHost() + ':' + uri.getPort()); } } } }
@Override public String getVirtualHost() { return delegate.getVirtualHost(); } }
private Realm kerberosChallenge(Channel channel,// List<String> authHeaders,// Request request,// FluentCaseInsensitiveStringsMap headers,// Realm realm,// NettyResponseFuture<?> future) throws NTLMEngineException { Uri uri = request.getUri(); String host = request.getVirtualHost() == null ? uri.getHost() : request.getVirtualHost(); try { String challengeHeader = SpnegoEngine.INSTANCE.generateToken(host); headers.remove(HttpHeaders.Names.AUTHORIZATION); headers.add(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader); return new Realm.RealmBuilder().clone(realm)// .setUri(uri)// .setMethodName(request.getMethod())// .setScheme(Realm.AuthScheme.KERBEROS)// .build(); } catch (Throwable throwable) { String ntlmAuthenticate = getNTLM(authHeaders); if (ntlmAuthenticate != null) { return ntlmChallenge(ntlmAuthenticate, request, headers, realm, future); } requestSender.abort(channel, future, throwable); return null; } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
private String hostHeader(Request request, UriComponents uri) { String host = request.getVirtualHost() != null ? request.getVirtualHost() : uri.getHost(); return request.getVirtualHost() != null || uri.getPort() == -1 ? host : host + ":" + uri.getPort(); }
.setVirtualHost(request.getVirtualHost()); if (keepBody) { requestBuilder.setBodyEncoding(request.getBodyEncoding());
if (proxyServer != null) host = proxyServer.getHost(); else if (request.getVirtualHost() != null) host = request.getVirtualHost(); else host = uri.getHost();
if (proxyServer != null) host = proxyServer.getHost(); else if (request.getVirtualHost() != null) host = request.getVirtualHost(); else host = uri.getHost();
String method = request.getMethod(); if (request.getVirtualHost() != null) { host = request.getVirtualHost(); if (uri.getPort() == -1 || request.getVirtualHost() != null) { urlConnection.setRequestProperty("Host", host); } else {
if (proxyServer != null) host = proxyServer.getHost(); else if (request.getVirtualHost() != null) host = request.getVirtualHost(); else host = uri.getHost();
private void addHostHeaderIfNeeded(final Request request, final Uri uri, final HttpRequestPacket requestPacket) { if (!requestPacket.containsHeader(Header.Host)) { String host = request.getVirtualHost(); if (host != null) { requestPacket.addHeader(Header.Host, host); } else { if (uri.getPort() == -1) { requestPacket.addHeader(Header.Host, uri.getHost()); } else { requestPacket.addHeader(Header.Host, uri.getHost() + ':' + uri.getPort()); } } } }
private void addHostHeaderIfNeeded(final Request request, final Uri uri, final HttpRequestPacket requestPacket) { if (!requestPacket.containsHeader(Header.Host)) { String host = request.getVirtualHost(); if (host != null) { requestPacket.addHeader(Header.Host, host); } else { if (uri.getPort() == -1) { requestPacket.addHeader(Header.Host, uri.getHost()); } else { requestPacket.addHeader(Header.Host, uri.getHost() + ':' + uri.getPort()); } } } }
private Realm kerberosChallenge(List<String> proxyAuth, Request request, ProxyServer proxyServer, FluentCaseInsensitiveStringsMap headers, Realm realm, NettyResponseFuture<?> future, boolean proxyInd) throws NTLMEngineException { UriComponents uri = request.getURI(); String host = request.getVirtualHost() == null ? uri.getHost() : request.getVirtualHost(); String server = proxyServer == null ? host : proxyServer.getHost(); try { String challengeHeader = SpnegoEngine.INSTANCE.generateToken(server); headers.remove(HttpHeaders.Names.AUTHORIZATION); headers.add(HttpHeaders.Names.AUTHORIZATION, "Negotiate " + challengeHeader); return newRealmBuilder(realm)// .setUri(uri)// .setMethodName(request.getMethod())// .setScheme(Realm.AuthScheme.KERBEROS)// .build(); } catch (Throwable throwable) { if (isNTLM(proxyAuth)) { return ntlmChallenge(proxyAuth, request, proxyServer, headers, realm, future, proxyInd); } requestSender.abort(future, throwable); return null; } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getURI(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<Cookie>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<Param>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<Part>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolKeyStrategy = prototype.getConnectionPoolKeyStrategy(); } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
String host = request.getVirtualHost(); if (host != null) { builder.header(Header.Host, host);