Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
1509 | major | always | 12-13-06 15:19 | 01-02-07 11:34 | |
|
|||||
Reporter: | justinwcs | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.0.22 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 3.0.23 | ||
|
|||||
Summary: | 0001509: getServerPort() returns incorrect number | ||||
Description: |
Found a bug in getServerPort(). If you have a host like "localhost:8091" getServerPort() will say your host is 61419 because of this code in the com.caucho.server.connection.AbstractHttpRequest getServerPort() method. This is in 3.0.22. int length = host.length(); int port = 0; for (int i = p1 + 1; i < length; i++) { char ch = host.charAt(i); if ('0' <= ch && ch <= '9') port = 10 * port + ch; } /** * Returns the server's port. */ public int getServerPort() { String host = _conn.getVirtualHost(); CharSequence rawHost; if (host == null && (rawHost = getHost()) != null) { int length = rawHost.length(); int i; for (i = length - 1; i >= 0; i--) { if (rawHost.charAt(i) == ':') { int port = 0; for (i++; i < length; i++) { char ch = rawHost.charAt(i); if ('0' <= ch && ch <= '9') port = 10 * port + ch - '0'; } return port; } } return isSecure() ? 443 : 80; } if (host == null) return _conn.getLocalPort(); int p1 = host.lastIndexOf(':'); if (p1 < 0) return isSecure() ? 443 : 80; else { int length = host.length(); int port = 0; for (int i = p1 + 1; i < length; i++) { char ch = host.charAt(i); if ('0' <= ch && ch <= '9') port = 10 * port + ch; } return port; } } |
||||
Steps To Reproduce: | |||||
Additional Information: | This bug prevents both the Cactus and Acegi security from doing redirects properly. | ||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|