Branch: Tag:

2014-08-01

2014-08-01 14:21:11 by Pontus Rodling <frigolit@frigolit.net>

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;    }