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

Function h2_brigade_copy_length

modules/http2/h2_util.c:1228–1265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1226}
1227
1228apr_status_t h2_brigade_copy_length(apr_bucket_brigade *dest,
1229 apr_bucket_brigade *src,
1230 apr_off_t length)
1231{
1232 apr_bucket *b, *next;
1233 apr_off_t remain = length;
1234 apr_status_t status = APR_SUCCESS;
1235
1236 for (b = APR_BRIGADE_FIRST(src);
1237 b != APR_BRIGADE_SENTINEL(src);
1238 b = next) {
1239 next = APR_BUCKET_NEXT(b);
1240
1241 if (APR_BUCKET_IS_METADATA(b)) {
1242 /* fall through */
1243 }
1244 else {
1245 if (remain <= 0) {
1246 return status;
1247 }
1248 if (b->length == ((apr_size_t)-1)) {
1249 const char *ign;
1250 apr_size_t ilen;
1251 status = apr_bucket_read(b, &ign, &ilen, APR_BLOCK_READ);
1252 if (status != APR_SUCCESS) {
1253 return status;
1254 }
1255 }
1256 fit_bucket_into(b, &remain);
1257 }
1258 status = apr_bucket_copy(b, &b);
1259 if (status != APR_SUCCESS) {
1260 return status;
1261 }
1262 APR_BRIGADE_INSERT_TAIL(dest, b);
1263 }
1264 return status;
1265}
1266
1267apr_size_t h2_util_bucket_print(char *buffer, apr_size_t bmax,
1268 apr_bucket *b, const char *sep)

Callers 2

h2_c2_filter_inFunction · 0.85
h2_c2_filter_request_inFunction · 0.85

Calls 1

fit_bucket_intoFunction · 0.85

Tested by

no test coverage detected