| 121 | } |
| 122 | |
| 123 | static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, |
| 124 | proxy_server_conf *conf, |
| 125 | char *url, const char *proxyname, |
| 126 | apr_port_t proxyport) |
| 127 | { |
| 128 | apr_status_t rv; |
| 129 | apr_socket_t *sock; |
| 130 | apr_socket_t *clientsock; |
| 131 | |
| 132 | if (ap_cstr_casecmpn(url, "fd://", 5) == 0) { |
| 133 | url += 5; |
| 134 | } |
| 135 | else { |
| 136 | return DECLINED; |
| 137 | } |
| 138 | |
| 139 | rv = get_socket_from_path(r->pool, url, &sock); |
| 140 | |
| 141 | if (rv != APR_SUCCESS) { |
| 142 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01152) |
| 143 | "Failed to connect to '%s'", url); |
| 144 | return HTTP_INTERNAL_SERVER_ERROR; |
| 145 | } |
| 146 | |
| 147 | { |
| 148 | int status; |
| 149 | const char *flush_method = *worker->s->flusher ? worker->s->flusher : "flush"; |
| 150 | |
| 151 | proxy_fdpass_flush *flush = ap_lookup_provider(PROXY_FDPASS_FLUSHER, |
| 152 | flush_method, "0"); |
| 153 | |
| 154 | if (!flush) { |
| 155 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01153) |
| 156 | "Unable to find configured flush provider '%s'", |
| 157 | flush_method); |
| 158 | return HTTP_INTERNAL_SERVER_ERROR; |
| 159 | } |
| 160 | |
| 161 | status = flush->flusher(r); |
| 162 | if (status) { |
| 163 | return status; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | clientsock = ap_get_conn_socket(r->connection); |
| 168 | |
| 169 | rv = send_socket(r->pool, sock, clientsock); |
| 170 | if (rv != APR_SUCCESS) { |
| 171 | ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01154) "send_socket failed:"); |
| 172 | return HTTP_INTERNAL_SERVER_ERROR; |
| 173 | } |
| 174 | |
| 175 | { |
| 176 | apr_socket_t *dummy; |
| 177 | /* Create a dummy unconnected socket, and set it as the one we were |
| 178 | * connected to, so that when the core closes it, it doesn't close |
| 179 | * the tcp connection to the client. |
| 180 | */ |
nothing calls this directly
no test coverage detected