Called for a new connection which has a known local_addr. Note that the * new connection is assumed to have conn->server == main server. */
| 1278 | * new connection is assumed to have conn->server == main server. |
| 1279 | */ |
| 1280 | AP_DECLARE(void) ap_update_vhost_given_ip(conn_rec *conn) |
| 1281 | { |
| 1282 | ipaddr_chain *trav; |
| 1283 | apr_port_t port; |
| 1284 | |
| 1285 | /* scan the hash table for an exact match first */ |
| 1286 | trav = find_ipaddr(conn->local_addr); |
| 1287 | |
| 1288 | if (trav) { |
| 1289 | /* save the name_chain for later in case this is a name-vhost */ |
| 1290 | conn->vhost_lookup_data = trav->names; |
| 1291 | conn->base_server = trav->server; |
| 1292 | return; |
| 1293 | } |
| 1294 | |
| 1295 | /* maybe there's a default server or wildcard name-based vhost |
| 1296 | * matching this port |
| 1297 | */ |
| 1298 | port = conn->local_addr->port; |
| 1299 | |
| 1300 | trav = find_default_server(port); |
| 1301 | if (trav) { |
| 1302 | conn->vhost_lookup_data = trav->names; |
| 1303 | conn->base_server = trav->server; |
| 1304 | return; |
| 1305 | } |
| 1306 | |
| 1307 | /* otherwise we're stuck with just the main server |
| 1308 | * and no name-based vhosts |
| 1309 | */ |
| 1310 | conn->vhost_lookup_data = NULL; |
| 1311 | } |
no test coverage detected