| 435 | } |
| 436 | |
| 437 | static void terminate_headers(proxy_http_req_t *req) |
| 438 | { |
| 439 | apr_bucket_alloc_t *bucket_alloc = req->bucket_alloc; |
| 440 | apr_bucket *e; |
| 441 | char *buf; |
| 442 | |
| 443 | /* |
| 444 | * Handle Connection: header if we do HTTP/1.1 request: |
| 445 | * If we plan to close the backend connection sent Connection: close |
| 446 | * otherwise sent Connection: Keep-Alive. |
| 447 | */ |
| 448 | if (!req->force10) { |
| 449 | if (req->upgrade) { |
| 450 | buf = apr_pstrdup(req->p, "Connection: Upgrade" CRLF); |
| 451 | ap_xlate_proto_to_ascii(buf, strlen(buf)); |
| 452 | e = apr_bucket_pool_create(buf, strlen(buf), req->p, bucket_alloc); |
| 453 | APR_BRIGADE_INSERT_TAIL(req->header_brigade, e); |
| 454 | |
| 455 | /* Tell the backend that it can upgrade the connection. */ |
| 456 | buf = apr_pstrcat(req->p, "Upgrade: ", req->upgrade, CRLF, NULL); |
| 457 | } |
| 458 | else if (ap_proxy_connection_reusable(req->backend)) { |
| 459 | buf = apr_pstrdup(req->p, "Connection: Keep-Alive" CRLF); |
| 460 | } |
| 461 | else { |
| 462 | buf = apr_pstrdup(req->p, "Connection: close" CRLF); |
| 463 | } |
| 464 | ap_xlate_proto_to_ascii(buf, strlen(buf)); |
| 465 | e = apr_bucket_pool_create(buf, strlen(buf), req->p, bucket_alloc); |
| 466 | APR_BRIGADE_INSERT_TAIL(req->header_brigade, e); |
| 467 | } |
| 468 | |
| 469 | /* add empty line at the end of the headers */ |
| 470 | e = apr_bucket_immortal_create(CRLF_ASCII, 2, bucket_alloc); |
| 471 | APR_BRIGADE_INSERT_TAIL(req->header_brigade, e); |
| 472 | } |
| 473 | |
| 474 | static int ap_proxy_http_prefetch(proxy_http_req_t *req, |
| 475 | apr_uri_t *uri, char *url) |
no test coverage detected