MCPcopy Create free account
hub / github.com/apache/httpd / fully_qualify_uri

Function fully_qualify_uri

modules/mappers/mod_rewrite.c:971–994  ·  view source on GitHub ↗

* add 'http[s]://ourhost[:ourport]/' to URI * if URI is still not fully qualified */

Source from the content-addressed store, hash-verified

969 * if URI is still not fully qualified
970 */
971static void fully_qualify_uri(request_rec *r)
972{
973 if (r->method_number == M_CONNECT) {
974 return;
975 }
976 else if (!is_absolute_uri(r->filename, NULL)) {
977 const char *thisserver;
978 char *thisport;
979 int port;
980
981 thisserver = ap_get_server_name_for_url(r);
982 port = ap_get_server_port(r);
983 thisport = ap_is_default_port(port, r)
984 ? ""
985 : apr_psprintf(r->pool, ":%u", port);
986
987 r->filename = apr_psprintf(r->pool, "%s://%s%s%s%s",
988 ap_http_scheme(r), thisserver, thisport,
989 (*r->filename == '/') ? "" : "/",
990 r->filename);
991 }
992
993 return;
994}
995
996static int startsWith(request_rec *r, const char *haystack, const char *needle) {
997 int rc = (ap_strstr_c(haystack, needle) == haystack);

Callers 1

apply_rewrite_ruleFunction · 0.85

Calls 3

is_absolute_uriFunction · 0.85
ap_get_server_portFunction · 0.85

Tested by

no test coverage detected