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

Function h2_append_brigade

modules/http2/h2_util.c:1320–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1318}
1319
1320apr_status_t h2_append_brigade(apr_bucket_brigade *to,
1321 apr_bucket_brigade *from,
1322 apr_off_t *plen,
1323 int *peos,
1324 h2_bucket_gate *should_append)
1325{
1326 apr_bucket *e;
1327 apr_off_t start, remain;
1328 apr_status_t rv;
1329
1330 *peos = 0;
1331 start = remain = *plen;
1332
1333 while (!APR_BRIGADE_EMPTY(from)) {
1334 e = APR_BRIGADE_FIRST(from);
1335
1336 if (!should_append(e)) {
1337 goto leave;
1338 }
1339 else if (APR_BUCKET_IS_METADATA(e)) {
1340 if (APR_BUCKET_IS_EOS(e)) {
1341 *peos = 1;
1342 apr_bucket_delete(e);
1343 continue;
1344 }
1345 }
1346 else {
1347 if (remain <= 0) {
1348 goto leave;
1349 }
1350 if (e->length == ((apr_size_t)-1)) {
1351 const char *ign;
1352 apr_size_t ilen;
1353 rv = apr_bucket_read(e, &ign, &ilen, APR_BLOCK_READ);
1354 if (rv != APR_SUCCESS) {
1355 return rv;
1356 }
1357 }
1358 fit_bucket_into(e, &remain);
1359 }
1360 APR_BUCKET_REMOVE(e);
1361 APR_BRIGADE_INSERT_TAIL(to, e);
1362 }
1363leave:
1364 *plen = start - remain;
1365 return APR_SUCCESS;
1366}
1367
1368apr_off_t h2_brigade_mem_size(apr_bucket_brigade *bb)
1369{

Callers 1

h2_stream_read_toFunction · 0.85

Calls 1

fit_bucket_intoFunction · 0.85

Tested by

no test coverage detected