1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00
phorge-phorge/src/aphront
epriestley c07ec8fee6 Preserve nonstandard ports during 404 redirects which add "/" to the ends of URIs
Summary:
Fixes T12058. When the user visits `/maniphest`, for example, we redirect to `/maniphest/`.

Since this redirect is very low-level (at the Aphront level, below the Site level) we need to preserve the request Host rather than correct it to `PhabricatorEnv::getURI()` or similar -- the request may be hiting a different Site like a blog domain.

Currently, we do not preserve the port. Instead, preserve the port if it is not a standard port for the protocol (80 for http, 443 for https).

Test Plan:
  - Made a request with a missing slash and a normal port in my browser, got redirected normally.
  - Made a request with a missing slash and a nonstandard port, got redirected on the same port.

```
$ curl -H 'Host: local.phacility.com:123' -v http://local.phacility.com/diffusion
*   Trying 127.0.0.1...
* Connected to local.phacility.com (127.0.0.1) port 80 (#0)
> GET /diffusion HTTP/1.1
...
>
< HTTP/1.1 302 Found
...
< Location: http://local.phacility.com:123/diffusion/
...
```

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12058

Differential Revision: https://secure.phabricator.com/D17134
2017-01-04 06:55:10 -08:00
..
__tests__ phtize all the things 2015-05-22 21:16:39 +10:00
configuration Fix an issue where unexpected debugging output would run afoul of automatic compression 2016-12-14 07:27:08 -08:00
exception Convert some whiny exceptions into quiet MalformedRequest exceptions 2016-08-16 15:50:21 -07:00
handler Convert some whiny exceptions into quiet MalformedRequest exceptions 2016-08-16 15:50:21 -07:00
httpparametertype Make the "All Day Event" control use a checkbox instead of a dropdown 2016-10-31 14:18:59 -07:00
interface Allow Controllers to return a wider range of "response-like" objects 2015-09-01 15:52:52 -07:00
response Fix an issue where unexpected debugging output would run afoul of automatic compression 2016-12-14 07:27:08 -08:00
sink Don't combine automatic output compression with "Content-Length" 2016-12-13 14:25:49 -08:00
site Allow custom Sites to have custom 404 controllers 2016-11-30 15:25:09 -08:00
AphrontController.php Provide an AphrontController implementation of willSendResponse() 2015-09-07 17:18:35 -07:00
AphrontRequest.php Preserve nonstandard ports during 404 redirects which add "/" to the ends of URIs 2017-01-04 06:55:10 -08:00