MCPcopy Index your code
hub / github.com/apache/httpd / ap_get_server_port

Function ap_get_server_port

server/core.c:1199–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r)
1200{
1201 apr_port_t port;
1202 core_dir_config *d =
1203 (core_dir_config *)ap_get_core_module_config(r->per_dir_config);
1204
1205 switch (d->use_canonical_name) {
1206 case USE_CANONICAL_NAME_OFF:
1207 case USE_CANONICAL_NAME_DNS:
1208 case USE_CANONICAL_NAME_UNSET:
1209 if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
1210 port = r->parsed_uri.port_str ? r->parsed_uri.port :
1211 r->connection->local_addr->port ? r->connection->local_addr->port :
1212 r->server->port ? r->server->port :
1213 ap_default_port(r);
1214 else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
1215 port = r->parsed_uri.port_str ? r->parsed_uri.port :
1216 r->server->port ? r->server->port :
1217 ap_default_port(r);
1218 break;
1219 case USE_CANONICAL_NAME_ON:
1220 /* With UseCanonicalName on (and in all versions prior to 1.3)
1221 * Apache will use the hostname and port specified in the
1222 * ServerName directive to construct a canonical name for the
1223 * server. (If no port was specified in the ServerName
1224 * directive, Apache uses the port supplied by the client if
1225 * any is supplied, and finally the default port for the protocol
1226 * used.
1227 */
1228 if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
1229 port = r->server->port ? r->server->port :
1230 r->connection->local_addr->port ? r->connection->local_addr->port :
1231 ap_default_port(r);
1232 else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
1233 port = r->server->port ? r->server->port :
1234 ap_default_port(r);
1235 break;
1236 default:
1237 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00110)
1238 "ap_get_server_port: Invalid UCN Option somehow");
1239 port = ap_default_port(r);
1240 break;
1241 }
1242
1243 return port;
1244}
1245
1246AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri,
1247 request_rec *r)

Callers 15

cache_canonicalise_keyFunction · 0.85
ssl_var_lookupFunction · 0.85
copy_uri_componentsFunction · 0.85
vhost_alias_interpolateFunction · 0.85
fully_qualify_uriFunction · 0.85
lookup_variableFunction · 0.85
hook_uri2fileFunction · 0.85
ssl_var_lookupFunction · 0.85
show_server_settingsFunction · 0.85
req_ap_get_server_portFunction · 0.85

Calls 1

Tested by

no test coverage detected