| 435 | } |
| 436 | |
| 437 | static 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) */ |
| 466 | PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p) |
no test coverage detected