Lines Matching refs:conn
1347 PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn)
1349 proxy_worker *worker = conn->worker;
1351 return ! (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse);
1356 proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
1357 proxy_worker *worker = conn->worker;
1367 if (conn->r) {
1368 apr_pool_destroy(conn->r->pool);
1369 conn->r = NULL;
1373 if (conn->inreslist) {
1374 ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool, APLOGNO(00923)
1376 " already returned to the connection pool.", conn,
1377 ap_proxy_worker_name(conn->pool, worker));
1382 if (!ap_proxy_connection_reusable(conn)) {
1383 apr_pool_t *p = conn->pool;
1385 conn = apr_pcalloc(p, sizeof(proxy_conn_rec));
1386 conn->pool = p;
1387 conn->worker = worker;
1388 apr_pool_create(&(conn->scpool), p);
1389 apr_pool_tag(conn->scpool, "proxy_conn_scpool");
1393 conn->inreslist = 1;
1394 apr_reslist_release(worker->cp->res, (void *)conn);
1398 worker->cp->conn = conn;
1405 static void socket_cleanup(proxy_conn_rec *conn)
1407 conn->sock = NULL;
1408 conn->connection = NULL;
1409 conn->ssl_hostname = NULL;
1410 apr_pool_clear(conn->scpool);
1413 PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn,
1427 if (conn->sock && conn->connection) {
1429 rv = ap_get_brigade(conn->connection->input_filters, bb,
1433 socket_cleanup(conn);
1454 proxy_conn_rec *conn;
1473 conn = apr_pcalloc(ctx, sizeof(proxy_conn_rec));
1475 conn->pool = ctx;
1476 conn->scpool = scpool;
1477 conn->worker = worker;
1478 conn->inreslist = 1;
1479 *resource = conn;
1488 proxy_conn_rec *conn = (proxy_conn_rec *)resource;
1491 if (conn->worker->cp->pool) {
1492 apr_pool_destroy(conn->pool);
1934 void *conn;
1936 rv = connection_constructor(&conn, worker, worker->cp->pool);
1937 worker->cp->conn = conn;
2171 proxy_conn_rec **conn,
2190 rv = apr_reslist_acquire(worker->cp->res, (void **)conn);
2194 if (!worker->cp->conn) {
2195 connection_constructor((void **)conn, worker, worker->cp->pool);
2198 *conn = worker->cp->conn;
2199 worker->cp->conn = NULL;
2214 (*conn)->worker = worker;
2215 (*conn)->close = 0;
2216 (*conn)->inreslist = 0;
2222 proxy_conn_rec *conn,
2227 proxy_function, conn->worker->s->hostname);
2228 connection_cleanup(conn);
2237 proxy_conn_rec *conn,
2277 if (!proxyname || conn->is_ssl) {
2290 * to check host and port on the conn and be careful about
2295 if (conn->uds_path == NULL) {
2296 /* use (*conn)->pool instead of worker->cp->pool to match lifetime */
2297 conn->uds_path = apr_pstrdup(conn->pool, uds_path);
2299 if (conn->uds_path) {
2302 uri->scheme, conn->uds_path);
2315 if (!conn->addr) {
2317 apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 0, 0, conn->pool);
2318 conn->addr = sa;
2320 conn->hostname = "httpd-UDS";
2321 conn->port = 0;
2325 if (!conn->hostname || !will_reuse) {
2327 conn->hostname = apr_pstrdup(conn->pool, proxyname);
2328 conn->port = proxyport;
2335 if (conn->is_ssl) {
2338 forward_info *forward = apr_pcalloc(conn->pool, sizeof(forward_info));
2339 conn->forward = forward;
2341 forward->target_host = apr_pstrdup(conn->pool, uri->hostname);
2354 forward->proxy_auth = apr_pstrdup(conn->pool, proxy_auth);
2359 conn->hostname = apr_pstrdup(conn->pool, uri->hostname);
2360 conn->port = uri->port;
2367 err = apr_sockaddr_info_get(&(conn->addr),
2368 conn->hostname, APR_UNSPEC,
2369 conn->port, 0,
2370 conn->pool);
2372 socket_cleanup(conn);
2373 conn->close = 0;
2393 conn->hostname, APR_UNSPEC,
2394 conn->port, 0,
2396 conn->addr = worker->cp->addr;
2402 conn->addr = worker->cp->addr;
2407 if (conn->close) {
2408 socket_cleanup(conn);
2409 conn->close = 0;
2415 conn->hostname, NULL));
2431 proxyname ? NULL : conn->addr)) {
2437 * and save it in conn->ssl_hostname. Close any reused connection whose
2440 if (conn->is_ssl) {
2452 else if (conn->forward
2453 && ((forward_info *)(conn->forward))->use_http_connect) {
2454 ssl_hostname = ((forward_info *)conn->forward)->target_host;
2457 ssl_hostname = conn->hostname;
2463 if ((conn->ssl_hostname && (!ssl_hostname ||
2464 strcasecmp(conn->ssl_hostname,
2466 (!conn->ssl_hostname && ssl_hostname && conn->sock)) {
2467 socket_cleanup(conn);
2469 if (conn->ssl_hostname == NULL) {
2470 conn->ssl_hostname = apr_pstrdup(conn->scpool, ssl_hostname);
2474 "connected %s to %s:%d", *url, conn->hostname, conn->port);
2696 proxy_conn_rec *conn,
2703 apr_sockaddr_t *backend_addr = conn->addr;
2711 if (conn->sock) {
2712 if (!(connected = ap_proxy_is_socket_connected(conn->sock))) {
2713 socket_cleanup(conn);
2719 while ((backend_addr || conn->uds_path) && !connected) {
2721 if (conn->uds_path)
2724 conn->scpool);
2734 conn->connection = NULL;
2736 rv = ap_proxy_connect_uds(newsock, conn->uds_path, conn->scpool);
2743 conn->uds_path,
2752 conn->uds_path,
2760 conn->scpool)) != APR_SUCCESS) {
2776 conn->connection = NULL;
2820 local_addr = apr_pmemdup(conn->pool, conf->source_address,
2822 local_addr->pool = conn->pool;
2865 conn->sock = newsock;
2867 if (!conn->uds_path && conn->forward) {
2868 forward_info *forward = (forward_info *)conn->forward;
2874 rv = send_http_connect(conn, s);
2877 conn->sock = NULL;
2931 apr_socket_close(conn->sock );
2932 conn->sock = NULL;
2940 proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
2941 conn_rec *c = conn->connection;
2945 apr_socket_timeout_get(conn->sock, &saved_timeout);
2947 apr_socket_timeout_set(conn->sock, 0);
2954 apr_socket_timeout_set(conn->sock, saved_timeout);
2966 proxy_conn_rec *conn,
2970 apr_sockaddr_t *backend_addr = conn->addr;
2975 if (conn->connection) {
2979 bucket_alloc = apr_bucket_alloc_create(conn->scpool);
2983 conn->connection = ap_run_create_connection(conn->scpool, s, conn->sock,
2987 if (!conn->connection) {
2995 backend_addr, conn->hostname);
2997 socket_cleanup(conn);
3002 if (conn->is_ssl) {
3003 if (!ap_proxy_ssl_enable(conn->connection)) {
3007 backend_addr, conn->hostname);
3013 ap_proxy_ssl_disable(conn->connection);
3018 proxy_function, backend_addr, conn->hostname);
3025 apr_socket_timeout_get(conn->sock, ¤t_timeout);
3027 rc = ap_run_pre_connection(conn->connection, conn->sock);
3029 conn->connection->aborted = 1;
3035 apr_socket_timeout_set(conn->sock, current_timeout);
3040 apr_pool_pre_cleanup_register(conn->scpool, conn, connection_shutdown);