@Override public void customize( Connector connector, HttpConfiguration channelConfig, Request request ) { request.setScheme( HttpScheme.HTTPS.asString() ); addResponseFieldIfConfigured( request, hstsResponseField ); }
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; if (!request.getServerName().equalsIgnoreCase(uri.getHost()) || request.getServerPort() != port || ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; if (!request.getServerName().equalsIgnoreCase(uri.getHost()) || request.getServerPort() != port || ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
/** * Construct a normalized URI. * Port is not set if it is the default port. * @param scheme the URI scheme * @param host the URI hose * @param port the URI port * @param path the URI path * @param param the URI param * @param query the URI query * @param fragment the URI fragment * @return the normalized URI */ public static HttpURI createHttpURI(String scheme, String host, int port, String path, String param, String query, String fragment) { if (port==80 && HttpScheme.HTTP.is(scheme)) port=0; if (port==443 && HttpScheme.HTTPS.is(scheme)) port=0; return new HttpURI(scheme,host,port,path,param,query,fragment); }
@Test public void shouldSetRequestSchemeToHttps() { Customizer customizer = newCustomizer(); Request request = mock( Request.class ); customize( customizer, request ); verify( request ).setScheme( HTTPS.asString() ); }
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; if (!request.getServerName().equalsIgnoreCase(uri.getHost()) || request.getServerPort() != port || ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
/** * Construct a normalized URI. * Port is not set if it is the default port. * @param scheme the URI scheme * @param host the URI hose * @param port the URI port * @param path the URI path * @param param the URI param * @param query the URI query * @param fragment the URI fragment * @return the normalized URI */ public static HttpURI createHttpURI(String scheme, String host, int port, String path, String param, String query, String fragment) { if (port==80 && HttpScheme.HTTP.is(scheme)) port=0; if (port==443 && HttpScheme.HTTPS.is(scheme)) port=0; return new HttpURI(scheme,host,port,path,param,query,fragment); }
public String getScheme() { if (_scheme==_authority) return null; int l=_authority-_scheme; if (l==5 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' ) return HttpScheme.HTTP.asString(); if (l==6 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' && _raw[_scheme+4]=='s' ) return HttpScheme.HTTPS.asString(); return new String(_raw,_scheme,_authority-_scheme-1,_charset); }
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
/** * Construct a normalized URI. * Port is not set if it is the default port. * @param scheme the URI scheme * @param host the URI hose * @param port the URI port * @param path the URI path * @param param the URI param * @param query the URI query * @param fragment the URI fragment * @return the normalized URI */ public static HttpURI createHttpURI(String scheme, String host, int port, String path, String param, String query, String fragment) { if (port==80 && HttpScheme.HTTP.is(scheme)) port=0; if (port==443 && HttpScheme.HTTPS.is(scheme)) port=0; return new HttpURI(scheme,host,port,path,param,query,fragment); }
public String getScheme() { if (_scheme==_authority) return null; int l=_authority-_scheme; if (l==5 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' ) return HttpScheme.HTTP.asString(); if (l==6 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' && _raw[_scheme+4]=='s' ) return HttpScheme.HTTPS.asString(); return new String(_raw,_scheme,_authority-_scheme-1,_charset); }
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
protected HttpDestination destinationFor(String scheme, String host, int port) { if (!HttpScheme.HTTP.is(scheme) && !HttpScheme.HTTPS.is(scheme) && !HttpScheme.WS.is(scheme) && !HttpScheme.WSS.is(scheme)) throw new IllegalArgumentException("Invalid protocol " + scheme); scheme = scheme.toLowerCase(Locale.ENGLISH); host = host.toLowerCase(Locale.ENGLISH); port = normalizePort(scheme, port); Origin origin = new Origin(scheme, host, port); HttpDestination destination = destinations.get(origin); if (destination == null) { destination = transport.newHttpDestination(origin); addManaged(destination); HttpDestination existing = destinations.putIfAbsent(origin, destination); if (existing != null) { removeBean(destination); destination = existing; } else { if (LOG.isDebugEnabled()) LOG.debug("Created {}", destination); } } return destination; }
public String getScheme() { if (_scheme==_authority) return null; int l=_authority-_scheme; if (l==5 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' ) return HttpScheme.HTTP.asString(); if (l==6 && _raw[_scheme]=='h' && _raw[_scheme+1]=='t' && _raw[_scheme+2]=='t' && _raw[_scheme+3]=='p' && _raw[_scheme+4]=='s' ) return HttpScheme.HTTPS.asString(); return new String(_raw,_scheme,_authority-_scheme-1,_charset); }
int port = uri.getPort(); if (port < 0) port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme()) ? 443 : 80; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path, insert the root path sessionURLPrefix + id; ((HttpScheme.HTTPS.is(uri.getScheme()) || HttpScheme.HTTP.is(uri.getScheme())) && uri.getPath() == null ? "/" : "") + //if no path so insert the root path sessionURLPrefix + id + url.substring(suffix);
@Override public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map<String, Object> context) throws IOException { endPoint.setIdleTimeout(getHttpClient().getIdleTimeout()); ClientConnectionFactory factory = connectionFactory; HttpDestinationOverHTTP2 destination = (HttpDestinationOverHTTP2)context.get(HTTP_DESTINATION_CONTEXT_KEY); ProxyConfiguration.Proxy proxy = destination.getProxy(); boolean ssl = proxy == null ? HttpScheme.HTTPS.is(destination.getScheme()) : proxy.isSecure(); if (ssl && isUseALPN()) factory = new ALPNClientConnectionFactory(client.getExecutor(), factory, client.getProtocols()); return factory.newConnection(endPoint, context); }
@Override public void customize(Connector connector, HttpConfiguration channelConfig, Request request) { EndPoint endp = request.getHttpChannel().getEndPoint(); if (endp instanceof DecryptedEndPoint) { SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint)endp; SslConnection sslConnection = ssl_endp.getSslConnection(); SSLEngine sslEngine=sslConnection.getSSLEngine(); customize(sslEngine,request); if (request.getHttpURI().getScheme()==null) request.setScheme(HttpScheme.HTTPS.asString()); } else if (endp instanceof ProxyConnectionFactory.ProxyEndPoint) { ProxyConnectionFactory.ProxyEndPoint proxy = (ProxyConnectionFactory.ProxyEndPoint)endp; if (request.getHttpURI().getScheme()==null && proxy.getAttribute(ProxyConnectionFactory.TLS_VERSION)!=null) request.setScheme(HttpScheme.HTTPS.asString()); } if (HttpScheme.HTTPS.is(request.getScheme())) customizeSecure(request); }
@Override public void connect(InetSocketAddress address, Map<String, Object> context) { HttpClient httpClient = getHttpClient(); client.setConnectTimeout(httpClient.getConnectTimeout()); client.setConnectBlocking(httpClient.isConnectBlocking()); client.setBindAddress(httpClient.getBindAddress()); SessionListenerPromise listenerPromise = new SessionListenerPromise(context); HttpDestinationOverHTTP2 destination = (HttpDestinationOverHTTP2)context.get(HTTP_DESTINATION_CONTEXT_KEY); SslContextFactory sslContextFactory = null; if (HttpScheme.HTTPS.is(destination.getScheme())) sslContextFactory = httpClient.getSslContextFactory(); connect(sslContextFactory, address, listenerPromise, listenerPromise, context); }