Roxen.git/
server/
etc/
modules/
Roxen.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-08-01
2014-08-01 14:44:09 by Pontus Rodling <frigolit@frigolit.net>
5f5cdafe41851f7f9a8b524966d987a5a47587d6 (
25
lines) (+
10
/-
15
)
[
Show
|
Annotate
]
Branch:
devel
Care about potential paths in id->url_base() as well. Updates [bug
7221 (#7221)
].
1375:
// Add protocol and host to local absolute URLs. if (has_prefix (url, "/")) { if(id) {
-
string
url_base
= id->url_base();
+
Standards.URI
uri
=
Standards.URI(
id->url_base()
)
;
+
+
// Handle proxies
string xf_proto = id->request_headers["x-forwarded-proto"]; string xf_host = id->request_headers["x-forwarded-host"]; if (xf_proto && xf_host) {
-
url_base
= xf_proto + "://" + xf_host +
"/"
;
+
uri
=
Standards.URI(
xf_proto + "://" + xf_host +
uri->path)
;
}
-
+
else if (xf_host) {
+
uri = Standards.URI(uri->scheme + "://" + xf_host + uri->path);
+
}
else if (xf_proto) {
-
Standards.URI
uri = Standards.URI(
id->url_base());
-
-
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;
+
uri = Standards.URI(xf_proto
+
"
://
"
+
uri->
host
+
uri->
path
);
}
-
url
_base
= (string)uri
;
-
}
-
-
url = url_base
+ url[1..];
+
url = (string)uri + url[1..];
if (!prestates) prestates = id->prestate; } else {