Lines 885-890
Link Here
|
885 |
return r->server->server_hostname; |
885 |
return r->server->server_hostname; |
886 |
} |
886 |
} |
887 |
|
887 |
|
|
|
888 |
/* |
889 |
* Get the current server name from the request for the purposes |
890 |
* of using in a URL. If the server name is an IPv6 literal |
891 |
* address, it will be returned in URL format (e.g., "[fe80::1]"). |
892 |
*/ |
893 |
static const char *get_server_name_for_url(request_rec *r) |
894 |
{ |
895 |
const char *plain_server_name = ap_get_server_name(r); |
896 |
|
897 |
#ifdef APR_HAVE_IPV6 |
898 |
if (ap_strchr_c(plain_server_name, ':')) { /* IPv6 literal? */ |
899 |
return apr_psprintf(r->pool, "[%s]", plain_server_name); |
900 |
} |
901 |
#endif |
902 |
return plain_server_name; |
903 |
} |
904 |
|
888 |
AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) |
905 |
AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r) |
889 |
{ |
906 |
{ |
890 |
apr_port_t port; |
907 |
apr_port_t port; |
Lines 925-931
Link Here
|
925 |
request_rec *r) |
942 |
request_rec *r) |
926 |
{ |
943 |
{ |
927 |
unsigned port = ap_get_server_port(r); |
944 |
unsigned port = ap_get_server_port(r); |
928 |
const char *host = ap_get_server_name(r); |
945 |
const char *host = get_server_name_for_url(r); |
929 |
|
946 |
|
930 |
if (ap_is_default_port(port, r)) { |
947 |
if (ap_is_default_port(port, r)) { |
931 |
return apr_pstrcat(p, ap_http_method(r), "://", host, uri, NULL); |
948 |
return apr_pstrcat(p, ap_http_method(r), "://", host, uri, NULL); |