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

Function feed_brigade

modules/http2/h2_proxy_session.c:994–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994static apr_status_t feed_brigade(h2_proxy_session *session, apr_bucket_brigade *bb)
995{
996 apr_status_t status = APR_SUCCESS;
997 apr_size_t readlen = 0;
998 ssize_t n;
999
1000 while (status == APR_SUCCESS && !APR_BRIGADE_EMPTY(bb)) {
1001 apr_bucket* b = APR_BRIGADE_FIRST(bb);
1002
1003 if (APR_BUCKET_IS_METADATA(b)) {
1004 /* nop */
1005 }
1006 else {
1007 const char *bdata = NULL;
1008 apr_size_t blen = 0;
1009
1010 status = apr_bucket_read(b, &bdata, &blen, APR_BLOCK_READ);
1011 if (status == APR_SUCCESS && blen > 0) {
1012 n = nghttp2_session_mem_recv(session->ngh2, (const uint8_t *)bdata, blen);
1013 ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c,
1014 "h2_proxy_session(%s): feeding %ld bytes -> %ld",
1015 session->id, (long)blen, (long)n);
1016 if (n < 0) {
1017 if (nghttp2_is_fatal((int)n)) {
1018 status = APR_EGENERAL;
1019 }
1020 }
1021 else {
1022 size_t rlen = (size_t)n;
1023 readlen += rlen;
1024 if (rlen < blen) {
1025 apr_bucket_split(b, rlen);
1026 }
1027 }
1028 }
1029 }
1030 apr_bucket_delete(b);
1031 }
1032
1033 ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, session->c,
1034 "h2_proxy_session(%s): fed %ld bytes of input to session",
1035 session->id, (long)readlen);
1036 if (readlen == 0 && status == APR_SUCCESS) {
1037 return APR_EAGAIN;
1038 }
1039 return status;
1040}
1041
1042static apr_status_t h2_proxy_session_read(h2_proxy_session *session, int block,
1043 apr_interval_time_t timeout)

Callers 1

h2_proxy_session_readFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected