| 472 | } |
| 473 | |
| 474 | static int ap_proxy_http_prefetch(proxy_http_req_t *req, |
| 475 | apr_uri_t *uri, char *url) |
| 476 | { |
| 477 | apr_pool_t *p = req->p; |
| 478 | request_rec *r = req->r; |
| 479 | conn_rec *c = r->connection; |
| 480 | proxy_conn_rec *p_conn = req->backend; |
| 481 | apr_bucket_alloc_t *bucket_alloc = req->bucket_alloc; |
| 482 | apr_bucket_brigade *header_brigade = req->header_brigade; |
| 483 | apr_bucket_brigade *input_brigade = req->input_brigade; |
| 484 | apr_bucket *e; |
| 485 | apr_off_t bytes_read = 0; |
| 486 | apr_off_t bytes; |
| 487 | int rv; |
| 488 | |
| 489 | rv = ap_proxy_create_hdrbrgd(p, header_brigade, r, p_conn, |
| 490 | req->worker, req->sconf, |
| 491 | uri, url, req->server_portstr, |
| 492 | &req->old_cl_val, &req->old_te_val); |
| 493 | if (rv != OK) { |
| 494 | return rv; |
| 495 | } |
| 496 | |
| 497 | /* sub-requests never use keepalives, and mustn't pass request bodies. |
| 498 | * Because the new logic looks at input_brigade, we will self-terminate |
| 499 | * input_brigade and jump past all of the request body logic... |
| 500 | * Reading anything with ap_get_brigade is likely to consume the |
| 501 | * main request's body or read beyond EOS - which would be unpleasant. |
| 502 | * |
| 503 | * An exception: when a kept_body is present, then subrequest CAN use |
| 504 | * pass request bodies, and we DONT skip the body. |
| 505 | */ |
| 506 | if (!r->kept_body && r->main) { |
| 507 | /* XXX: Why DON'T sub-requests use keepalives? */ |
| 508 | p_conn->close = 1; |
| 509 | req->old_te_val = NULL; |
| 510 | req->old_cl_val = NULL; |
| 511 | req->rb_method = RB_STREAM_CL; |
| 512 | e = apr_bucket_eos_create(input_brigade->bucket_alloc); |
| 513 | APR_BRIGADE_INSERT_TAIL(input_brigade, e); |
| 514 | goto skip_body; |
| 515 | } |
| 516 | |
| 517 | /* WE only understand chunked. Other modules might inject |
| 518 | * (and therefore, decode) other flavors but we don't know |
| 519 | * that the can and have done so unless they remove |
| 520 | * their decoding from the headers_in T-E list. |
| 521 | * XXX: Make this extensible, but in doing so, presume the |
| 522 | * encoding has been done by the extensions' handler, and |
| 523 | * do not modify add_te_chunked's logic |
| 524 | */ |
| 525 | if (req->old_te_val && ap_cstr_casecmp(req->old_te_val, "chunked") != 0) { |
| 526 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01093) |
| 527 | "%s Transfer-Encoding is not supported", |
| 528 | req->old_te_val); |
| 529 | return HTTP_INTERNAL_SERVER_ERROR; |
| 530 | } |
| 531 |
no test coverage detected