Mercurial Hosting > luan
changeset 889:5731a7707466
remove _forwarded
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 06 Oct 2016 23:24:30 -0600 |
parents | 1aa58272794f |
children | 5dc615c34848 |
files | src/org/eclipse/jetty/server/Connector.java |
diffstat | 1 files changed, 1 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
diff -r 1aa58272794f -r 5731a7707466 src/org/eclipse/jetty/server/Connector.java --- a/src/org/eclipse/jetty/server/Connector.java Thu Oct 06 23:12:00 2016 -0600 +++ b/src/org/eclipse/jetty/server/Connector.java Thu Oct 06 23:24:30 2016 -0600 @@ -69,7 +69,6 @@ private int _acceptors = 1; private int _acceptorPriorityOffset = 0; private boolean _useDNS; - private boolean _forwarded; private String _hostHeader; private String _forwardedHostHeader = HttpHeaders.X_FORWARDED_HOST; @@ -313,87 +312,8 @@ } } - /* ------------------------------------------------------------ */ public void customize(EndPoint endpoint, Request request) throws IOException { - if (isForwarded()) - checkForwardedHeaders(endpoint,request); - } - - /* ------------------------------------------------------------ */ - protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException - { - HttpFields httpFields = request.getConnection().getRequestFields(); - - // Do SSL first - if (getForwardedCipherSuiteHeader()!=null) - { - String cipher_suite=httpFields.getStringField(getForwardedCipherSuiteHeader()); - if (cipher_suite!=null) - request.setAttribute("javax.servlet.request.cipher_suite",cipher_suite); - } - if (getForwardedSslSessionIdHeader()!=null) - { - String ssl_session_id=httpFields.getStringField(getForwardedSslSessionIdHeader()); - if(ssl_session_id!=null) - { - request.setAttribute("javax.servlet.request.ssl_session_id", ssl_session_id); - request.setScheme(HttpSchemes.HTTPS); - } - } - - // Retrieving headers from the request - String forwardedHost = getLeftMostFieldValue(httpFields,getForwardedHostHeader()); - String forwardedServer = getLeftMostFieldValue(httpFields,getForwardedServerHeader()); - String forwardedFor = getLeftMostFieldValue(httpFields,getForwardedForHeader()); - String forwardedProto = getLeftMostFieldValue(httpFields,getForwardedProtoHeader()); - - if (_hostHeader != null) - { - // Update host header - httpFields.put(HttpHeaders.HOST_BUFFER,_hostHeader); - request.setServerName(null); - request.setServerPort(-1); - request.getServerName(); - } - else if (forwardedHost != null) - { - // Update host header - httpFields.put(HttpHeaders.HOST_BUFFER,forwardedHost); - request.setServerName(null); - request.setServerPort(-1); - request.getServerName(); - } - else if (forwardedServer != null) - { - // Use provided server name - request.setServerName(forwardedServer); - } - - if (forwardedFor != null) - { - request.setRemoteAddr(forwardedFor); - InetAddress inetAddress = null; - - if (_useDNS) - { - try - { - inetAddress = InetAddress.getByName(forwardedFor); - } - catch (UnknownHostException e) - { - LOG.trace("",e); - } - } - - request.setRemoteHost(inetAddress == null?forwardedFor:inetAddress.getHostName()); - } - - if (forwardedProto != null) - { - request.setScheme(forwardedProto); - } } /* ------------------------------------------------------------ */ @@ -476,7 +396,7 @@ */ public boolean isConfidential(Request request) { - return _forwarded && request.getScheme().equalsIgnoreCase(HttpSchemes.HTTPS); + return false; } /* ------------------------------------------------------------ */ @@ -540,36 +460,6 @@ } /* ------------------------------------------------------------ */ - /** - * Is reverse proxy handling on? - * - * @return true if this connector is checking the x-forwarded-for/host/server headers - */ - public boolean isForwarded() - { - return _forwarded; - } - - /* ------------------------------------------------------------ */ - /** - * Set reverse proxy handling. If set to true, then the X-Forwarded headers (or the headers set in their place) are looked for to set the request protocol, - * host, server and client ip. - * - * @param check - * true if this connector is checking the x-forwarded-for/host/server headers - * @see #setForwardedForHeader(String) - * @see #setForwardedHostHeader(String) - * @see #setForwardedProtoHeader(String) - * @see #setForwardedServerHeader(String) - */ - public void setForwarded(boolean check) - { - if (check) - LOG.debug("{} is forwarded",this); - _forwarded = check; - } - - /* ------------------------------------------------------------ */ public String getHostHeader() { return _hostHeader;