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

Function ap_proxy_determine_connection

modules/proxy/proxy_util.c:3237–3480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3235}
3236
3237PROXY_DECLARE(int)
3238ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
3239 proxy_server_conf *conf,
3240 proxy_worker *worker,
3241 proxy_conn_rec *conn,
3242 apr_uri_t *uri,
3243 char **url,
3244 const char *proxyname,
3245 apr_port_t proxyport,
3246 char *server_portstr,
3247 int server_portstr_size)
3248{
3249 int server_port;
3250 const char *uds_path;
3251
3252 /*
3253 * Break up the URL to determine the host to connect to
3254 */
3255
3256 /* we break the URL into host, port, uri */
3257 if (APR_SUCCESS != apr_uri_parse(p, *url, uri)) {
3258 return ap_proxyerror(r, HTTP_BAD_REQUEST,
3259 apr_pstrcat(p,"URI cannot be parsed: ", *url,
3260 NULL));
3261 }
3262
3263 if (!uri->hostname) {
3264 return ap_proxyerror(r, HTTP_BAD_REQUEST,
3265 apr_pstrcat(p,"URI has no hostname: ", *url,
3266 NULL));
3267 }
3268
3269 if (!uri->port) {
3270 uri->port = ap_proxy_port_of_scheme(uri->scheme);
3271 }
3272
3273 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00944)
3274 "connecting %s to %s:%d", *url, uri->hostname, uri->port);
3275
3276 /* Close a possible existing socket if we are told to do so */
3277 if (conn->close) {
3278 socket_cleanup(conn);
3279 }
3280
3281 /*
3282 * allocate these out of the specified connection pool
3283 * The scheme handler decides if this is permanent or
3284 * short living pool.
3285 */
3286 /* Unless we are connecting the backend via a (forward Proxy)Remote, we
3287 * have to use the original form of the URI (non absolute), but this is
3288 * also the case via a remote proxy using the CONNECT method since the
3289 * original request (and URI) is to be embedded in the body.
3290 */
3291 if (!proxyname || conn->is_ssl) {
3292 *url = apr_pstrcat(p, uri->path, uri->query ? "?" : "",
3293 uri->query ? uri->query : "",
3294 uri->fragment ? "#" : "",

Callers 7

proxy_fcgi_handlerFunction · 0.85
proxy_http_handlerFunction · 0.85
uwsgi_handlerFunction · 0.85
proxy_wstunnel_handlerFunction · 0.85
proxy_ajp_handlerFunction · 0.85
scgi_handlerFunction · 0.85
proxy_http2_handlerFunction · 0.85

Calls 9

ap_proxyerrorFunction · 0.85
ap_proxy_port_of_schemeFunction · 0.85
socket_cleanupFunction · 0.85
conn_cleanupFunction · 0.85
ap_cstr_casecmpFunction · 0.85
ap_get_server_portFunction · 0.85
ap_get_module_configFunction · 0.85

Tested by

no test coverage detected