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

Function proxy_get_host_of_request

modules/proxy/proxy_util.c:437–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437static const char *
438 proxy_get_host_of_request(request_rec *r)
439{
440 char *url, *user = NULL, *password = NULL, *err, *host = NULL;
441 apr_port_t port;
442
443 if (r->hostname != NULL) {
444 return r->hostname;
445 }
446
447 /* Set url to the first char after "scheme://" */
448 if ((url = strchr(r->uri, ':')) == NULL || url[1] != '/' || url[2] != '/') {
449 return NULL;
450 }
451
452 url = apr_pstrdup(r->pool, &url[1]); /* make it point to "//", which is what proxy_canon_netloc expects */
453
454 err = ap_proxy_canon_netloc(r->pool, &url, &user, &password, &host, &port);
455
456 if (err != NULL) {
457 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00899) "%s", err);
458 }
459
460 r->hostname = host;
461
462 return host; /* ought to return the port, too */
463}
464
465/* Return TRUE if addr represents an IP address (or an IP network address) */
466PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p)

Callers 4

proxy_match_ipaddrFunction · 0.85
proxy_match_domainnameFunction · 0.85
proxy_match_hostnameFunction · 0.85
proxy_match_wordFunction · 0.85

Calls 1

ap_proxy_canon_netlocFunction · 0.85

Tested by

no test coverage detected