Roxen.git/
server/
etc/
modules/
Roxen.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-08-01
2014-08-01 14:21:11 by Pontus Rodling <frigolit@frigolit.net>
8424a04bf3ceb924f4572a5264d15da0b7cb2afe (
19
lines) (+
13
/-
6
)
[
Show
|
Annotate
]
Branch:
devel
Dropped X-Forwarded-By for the more common X-Forwarded-Host. Updates [bug
7221 (#7221)
].
1377:
if(id) { string url_base = id->url_base(); string xf_proto = id->request_headers["x-forwarded-proto"];
-
string xf_
by
= id->request_headers["x-forwarded-
by
"];
+
string xf_
host
= id->request_headers["x-forwarded-
host
"];
-
if (xf_proto
||
id->request
_
headers[
"
x-forwarded-by
"
]
) {
+
if (xf_proto
&&
xf
_
host) {
+
url_base = xf_proto +
"
://
"
+ xf_host + "/";
+
}
+
else if (xf_proto
) {
Standards.URI uri = Standards.URI(id->url_base());
-
if (xf_proto && (< "http", "https" >)[xf_proto])
+
if (xf_proto && (< "http", "https" >)[xf_proto])
{
+
if (xf_proto == "https" && uri->scheme == "http" && uri->port == 80)
+
uri->port = 443;
+
else if (xf_proto == "http" && uri->scheme == "https" && uri->port == 443)
+
uri->port = 80;
+
uri->scheme = xf_proto;
-
+
}
-
if (xf_by && glob("*:*", xf_by))
-
sscanf(xf_by, "%*s:%d", uri->port);
-
+
url_base = (string)uri; }