You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/02/09 08:41:55 UTC
svn commit: r1242231 -
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java
Author: fmui
Date: Thu Feb 9 07:41:55 2012
New Revision: 1242231
URL: http://svn.apache.org/viewvc?rev=1242231&view=rev
Log:
CMIS-500: proxy handling improvements
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java?rev=1242231&r1=1242230&r2=1242231&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ProxyHttpServletRequestWrapper.java Thu Feb 9 07:41:55 2012
@@ -37,7 +37,7 @@ public class ProxyHttpServletRequestWrap
scheme = request.getHeader(FORWARDED_PROTO_HEADER);
- if (!HTTP_SCHEME.equals(scheme) && !HTTPS_SCHEME.equals(scheme)) {
+ if (!HTTP_SCHEME.equalsIgnoreCase(scheme) && !HTTPS_SCHEME.equalsIgnoreCase(scheme)) {
scheme = request.getScheme();
}
@@ -49,16 +49,26 @@ public class ProxyHttpServletRequestWrap
int index = host.indexOf(':');
if (index < 0) {
serverName = host;
+ serverPort = getDefaultPort(scheme);
} else {
serverName = host.substring(0, index);
try {
serverPort = Integer.parseInt(host.substring(index + 1));
} catch (NumberFormatException e) {
+ serverPort = getDefaultPort(scheme);
}
}
}
}
+ private int getDefaultPort(String scheme) {
+ if (HTTPS_SCHEME.equalsIgnoreCase(scheme)) {
+ return 443;
+ }
+
+ return 80;
+ }
+
@Override
public String getScheme() {
return scheme;