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

Function hc_read_body

modules/proxy/mod_proxy_hcheck.c:794–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792}
793
794static int hc_read_body(request_rec *r, apr_bucket_brigade *bb)
795{
796 apr_status_t rv = APR_SUCCESS;
797 int seen_eos = 0;
798
799 do {
800 apr_size_t len = HUGE_STRING_LEN;
801
802 apr_brigade_cleanup(bb);
803 rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_READBYTES,
804 APR_BLOCK_READ, len);
805
806 if (rv != APR_SUCCESS) {
807 if (APR_STATUS_IS_EOF(rv)) {
808 rv = APR_SUCCESS;
809 break;
810 }
811 ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server, APLOGNO(03300)
812 "Error reading response body");
813 break;
814 }
815
816 while (!APR_BRIGADE_EMPTY(bb)) {
817 apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
818 if (APR_BUCKET_IS_EOS(bucket)) {
819 seen_eos = 1;
820 break;
821 }
822 if (APR_BUCKET_IS_FLUSH(bucket)) {
823 apr_bucket_delete(bucket);
824 continue;
825 }
826 APR_BUCKET_REMOVE(bucket);
827 APR_BRIGADE_INSERT_TAIL(r->kept_body, bucket);
828 }
829 }
830 while (!seen_eos);
831 apr_brigade_cleanup(bb);
832 return (rv == APR_SUCCESS ? OK : !OK);
833}
834
835/*
836 * Send the HTTP OPTIONS, HEAD or GET request to the backend

Callers 1

hc_check_httpFunction · 0.85

Calls 2

ap_get_brigadeFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected