static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
request_rec *r, apr_pool_t *setaside_pool,
- apr_uint16_t request_id)
+ apr_uint16_t request_id,
+ const char **err)
{
apr_bucket_brigade *ib, *ob;
int seen_end_of_headers = 0, done = 0;
apr_size_t iobuf_size = AP_IOBUFSIZE;
char *iobuf = stack_iobuf;
+ *err = NULL;
if (conn->worker->s->io_buffer_size_set) {
iobuf_size = conn->worker->s->io_buffer_size;
iobuf = apr_palloc(r->pool, iobuf_size);
if (APR_STATUS_IS_EINTR(rv)) {
continue;
}
+ *err = "polling";
break;
}
AP_MODE_READBYTES, APR_BLOCK_READ,
iobuf_size);
if (rv != APR_SUCCESS) {
+ *err = "reading input brigade";
break;
}
apr_brigade_cleanup(ib);
if (rv != APR_SUCCESS) {
+ *err = "flattening brigade";
break;
}
rv = send_data(conn, vec, nvec, &len, 0);
if (rv != APR_SUCCESS) {
+ *err = "sending stdin";
break;
}
vec[0].iov_len = sizeof(farray);
rv = send_data(conn, vec, 1, &len, 1);
+ if (rv != APR_SUCCESS) {
+ *err = "sending empty stdin";
+ break;
+ }
}
}
}
if (readbuflen != 0) {
rv = get_data(conn, iobuf, &readbuflen);
if (rv != APR_SUCCESS) {
+ *err = "reading response body";
break;
}
}
*/
rv = ap_pass_brigade(r->output_filters, ob);
if (rv != APR_SUCCESS) {
+ *err = "passing brigade to output filters";
break;
}
}
if (script_error_status == HTTP_OK) {
rv = ap_pass_brigade(r->output_filters, ob);
if (rv != APR_SUCCESS) {
+ *err = "passing brigade to output filters";
break;
}
}
APR_BRIGADE_INSERT_TAIL(ob, b);
rv = ap_pass_brigade(r->output_filters, ob);
if (rv != APR_SUCCESS) {
+ *err = "passing brigade to output filters";
break;
}
}
apr_uint16_t request_id = 1;
apr_status_t rv;
apr_pool_t *temp_pool;
+ const char *err;
/* Step 1: Send AP_FCGI_BEGIN_REQUEST */
rv = send_begin_request(conn, request_id);
}
/* Step 3: Read records from the back end server and handle them. */
- rv = dispatch(conn, conf, r, temp_pool, request_id);
+ rv = dispatch(conn, conf, r, temp_pool, request_id, &err);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01075)
- "Error dispatching request to %s:", server_portstr);
+ "Error dispatching request to %s: %s%s%s",
+ server_portstr,
+ err ? "(" : "",
+ err ? err : "",
+ err ? ")" : "");
conn->close = 1;
return HTTP_SERVICE_UNAVAILABLE;
}