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

Function ap_proxy_pass_brigade

modules/proxy/proxy_util.c:5091–5130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5089}
5090
5091PROXY_DECLARE(int) ap_proxy_pass_brigade(apr_bucket_alloc_t *bucket_alloc,
5092 request_rec *r, proxy_conn_rec *p_conn,
5093 conn_rec *origin, apr_bucket_brigade *bb,
5094 int flush)
5095{
5096 apr_status_t status;
5097 apr_off_t transferred;
5098
5099 if (flush) {
5100 apr_bucket *e = apr_bucket_flush_create(bucket_alloc);
5101 APR_BRIGADE_INSERT_TAIL(bb, e);
5102 }
5103 apr_brigade_length(bb, 0, &transferred);
5104 if (transferred != -1)
5105 p_conn->worker->s->transferred += transferred;
5106 status = ap_pass_brigade(origin->output_filters, bb);
5107 /* Cleanup the brigade now to avoid buckets lifetime
5108 * issues in case of error returned below. */
5109 apr_brigade_cleanup(bb);
5110 if (status != APR_SUCCESS) {
5111 ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(01084)
5112 "pass request body failed to %pI (%s)",
5113 p_conn->addr, p_conn->hostname);
5114 if (origin->aborted) {
5115 const char *ssl_note;
5116
5117 if (((ssl_note = apr_table_get(origin->notes, "SSL_connect_rv"))
5118 != NULL) && (strcmp(ssl_note, "err") == 0)) {
5119 return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR,
5120 "Error during SSL Handshake with"
5121 " remote server");
5122 }
5123 return APR_STATUS_IS_TIMEUP(status) ? HTTP_GATEWAY_TIME_OUT : HTTP_BAD_GATEWAY;
5124 }
5125 else {
5126 return HTTP_BAD_REQUEST;
5127 }
5128 }
5129 return OK;
5130}
5131
5132/* Fill in unknown schemes from apr_uri_port_of_scheme() */
5133

Callers 4

stream_reqbodyFunction · 0.85
ap_proxy_http_requestFunction · 0.85
proxy_wstunnel_requestFunction · 0.85
ap_proxy_read_inputFunction · 0.85

Calls 2

ap_pass_brigadeFunction · 0.85
ap_proxyerrorFunction · 0.85

Tested by

no test coverage detected