Roxen.git
/
server
/
etc
/
modules
/
Roxen.pmod
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/etc/modules/Roxen.pmod:1368:
//! eight bit chars and wider. All variable names and values in //! @[variables] are thoroughly encoded using @[http_encode_url] so //! they should not be encoded in any way to begin with. { // If the URL is a local relative URL we make it absolute. url = fix_relative(url, id); // 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 { // Ok, no domain present in the URL and no ID object given. // Perhaps one should dare throw an error here, but since most // UA can handle the redirect it is nicer no to. } } if(prestates && sizeof(prestates))