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

Function handle_response

modules/aaa/mod_authnz_fcgi.c:465–683  ·  view source on GitHub ↗

* handle_response() is based on mod_proxy_fcgi's dispatch() */

Source from the content-addressed store, hash-verified

463 * handle_response() is based on mod_proxy_fcgi's dispatch()
464 */
465static apr_status_t handle_response(const fcgi_provider_conf *conf,
466 request_rec *r, apr_socket_t *s,
467 apr_pool_t *temp_pool,
468 apr_uint16_t request_id,
469 char *rspbuf,
470 apr_size_t *rspbuflen)
471{
472 apr_bucket *b;
473 apr_bucket_brigade *ob;
474 apr_size_t orspbuflen = 0;
475 apr_status_t rv = APR_SUCCESS;
476 const char *fn = "handle_response";
477 int header_state = HDR_STATE_READING_HEADERS;
478 int seen_end_of_headers = 0, done = 0;
479
480 if (rspbuflen) {
481 orspbuflen = *rspbuflen;
482 *rspbuflen = 0; /* unless we actually read something */
483 }
484
485 ob = apr_brigade_create(r->pool, r->connection->bucket_alloc);
486
487 while (!done && rv == APR_SUCCESS) { /* Keep reading FastCGI records until
488 * we get AP_FCGI_END_REQUEST (done)
489 * or an error occurs.
490 */
491 apr_size_t readbuflen;
492 apr_uint16_t clen;
493 apr_uint16_t rid;
494 char readbuf[AP_IOBUFSIZE + 1];
495 unsigned char farray[AP_FCGI_HEADER_LEN];
496 unsigned char plen;
497 unsigned char type;
498 unsigned char version;
499
500 rv = recv_data_full(conf, r, s, (char *)farray, AP_FCGI_HEADER_LEN);
501 if (rv != APR_SUCCESS) {
502 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
503 APLOGNO(02501) "%s: Error occurred before reading "
504 "entire header", fn);
505 break;
506 }
507
508 ap_fcgi_header_fields_from_array(&version, &type, &rid, &clen, &plen,
509 farray);
510
511 if (version != AP_FCGI_VERSION_1) {
512 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
513 APLOGNO(02502) "%s: Got bogus FastCGI header "
514 "version %d", fn, (int)version);
515 rv = APR_EINVAL;
516 break;
517 }
518
519 if (rid != request_id) {
520 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
521 APLOGNO(02503) "%s: Got bogus FastCGI header "
522 "request id %d, expected %d",

Callers 1

req_rspFunction · 0.85

Calls 5

recv_data_fullFunction · 0.85
recv_dataFunction · 0.85
handle_headersFunction · 0.70

Tested by

no test coverage detected