Apache automatically sets the env variable
REMOTE_PORT to the remote port.
Allow the user to set "JkEnvVar REMOTE_PORT" and
let us accept the port in the forwarded attribute
as the remote port.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@756926
13f79535-47bb-0310-9956-
ffa450edef68
requestHeaderMessage.getBytes(tmpMB);
String v = tmpMB.toString();
request.setAttribute(n, v);
+ /*
+ * AJP13 misses to forward the remotePort.
+ * Apache automatically sets REMOTE_PORT to the remote port.
+ * Allow the user to set "JkEnvVar REMOTE_PORT" and
+ * let us accept the forwarded port as the remote port.
+ */
+ if(n.equals("REMOTE_PORT")) {
+ try {
+ request.setRemotePort(Integer.parseInt(v));
+ } catch (NumberFormatException nfe) {
+ }
+ }
break;
case Constants.SC_A_CONTEXT :
requestHeaderMessage.getBytes(tmpMB);
String v = tmpMB.toString();
request.setAttribute(n, v);
+ /*
+ * AJP13 misses to forward the remotePort.
+ * Apache automatically sets REMOTE_PORT to the remote port.
+ * Allow the user to set "JkEnvVar REMOTE_PORT" and
+ * let us accept the forwarded port as the remote port.
+ */
+ if(n.equals("REMOTE_PORT")) {
+ try {
+ request.setRemotePort(Integer.parseInt(v));
+ } catch (NumberFormatException nfe) {
+ }
+ }
break;
case Constants.SC_A_CONTEXT :
req.setAttribute(n, v );
if(log.isTraceEnabled())
log.trace("jk Attribute set " + n + "=" + v);
+ /*
+ * AJP13 misses to forward the remotePort.
+ * Apache automatically sets REMOTE_PORT to the remote port.
+ * Allow the user to set "JkEnvVar REMOTE_PORT" and
+ * let us accept the forwarded port as the remote port.
+ */
+ if(n.equals("REMOTE_PORT")) {
+ try {
+ req.setRemotePort(Integer.parseInt(v));
+ } catch (NumberFormatException nfe) {
+ }
+ }
}