DEPRECATED */
| 2697 | |
| 2698 | /* DEPRECATED */ |
| 2699 | PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock, |
| 2700 | const char *proxy_function, |
| 2701 | apr_sockaddr_t *backend_addr, |
| 2702 | const char *backend_name, |
| 2703 | proxy_server_conf *conf, |
| 2704 | request_rec *r) |
| 2705 | { |
| 2706 | apr_status_t rv; |
| 2707 | int connected = 0; |
| 2708 | int loglevel; |
| 2709 | |
| 2710 | while (backend_addr && !connected) { |
| 2711 | if ((rv = apr_socket_create(newsock, backend_addr->family, |
| 2712 | SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) { |
| 2713 | loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; |
| 2714 | ap_log_rerror(APLOG_MARK, loglevel, rv, r, APLOGNO(00935) |
| 2715 | "%s: error creating fam %d socket for target %s", |
| 2716 | proxy_function, backend_addr->family, backend_name); |
| 2717 | /* |
| 2718 | * this could be an IPv6 address from the DNS but the |
| 2719 | * local machine won't give us an IPv6 socket; hopefully the |
| 2720 | * DNS returned an additional address to try |
| 2721 | */ |
| 2722 | backend_addr = backend_addr->next; |
| 2723 | continue; |
| 2724 | } |
| 2725 | |
| 2726 | if (conf->recv_buffer_size > 0 && |
| 2727 | (rv = apr_socket_opt_set(*newsock, APR_SO_RCVBUF, |
| 2728 | conf->recv_buffer_size))) { |
| 2729 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00936) |
| 2730 | "apr_socket_opt_set(SO_RCVBUF): Failed to set " |
| 2731 | "ProxyReceiveBufferSize, using default"); |
| 2732 | } |
| 2733 | |
| 2734 | rv = apr_socket_opt_set(*newsock, APR_TCP_NODELAY, 1); |
| 2735 | if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) { |
| 2736 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00937) |
| 2737 | "apr_socket_opt_set(APR_TCP_NODELAY): " |
| 2738 | "Failed to set"); |
| 2739 | } |
| 2740 | |
| 2741 | /* Set a timeout on the socket */ |
| 2742 | if (conf->timeout_set) { |
| 2743 | apr_socket_timeout_set(*newsock, conf->timeout); |
| 2744 | } |
| 2745 | else { |
| 2746 | apr_socket_timeout_set(*newsock, r->server->timeout); |
| 2747 | } |
| 2748 | |
| 2749 | ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, |
| 2750 | "%s: fam %d socket created to connect to %s", |
| 2751 | proxy_function, backend_addr->family, backend_name); |
| 2752 | |
| 2753 | if (conf->source_address) { |
| 2754 | apr_sockaddr_t *local_addr; |
| 2755 | /* Make a copy since apr_socket_bind() could change |
| 2756 | * conf->source_address, which we don't want. |
no outgoing calls
no test coverage detected