| 373 | } |
| 374 | |
| 375 | apr_status_t h2_c1_io_append(h2_c1_io *io, apr_bucket_brigade *bb) |
| 376 | { |
| 377 | apr_bucket *b; |
| 378 | apr_status_t rv = APR_SUCCESS; |
| 379 | |
| 380 | while (!APR_BRIGADE_EMPTY(bb)) { |
| 381 | b = APR_BRIGADE_FIRST(bb); |
| 382 | if (APR_BUCKET_IS_METADATA(b) || APR_BUCKET_IS_MMAP(b)) { |
| 383 | /* need to finish any open scratch bucket, as meta data |
| 384 | * needs to be forward "in order". */ |
| 385 | append_scratch(io); |
| 386 | APR_BUCKET_REMOVE(b); |
| 387 | APR_BRIGADE_INSERT_TAIL(io->output, b); |
| 388 | } |
| 389 | else { |
| 390 | apr_size_t remain = assure_scratch_space(io); |
| 391 | if (b->length > remain) { |
| 392 | apr_bucket_split(b, remain); |
| 393 | if (io->slen == 0) { |
| 394 | /* complete write_size bucket, append unchanged */ |
| 395 | APR_BUCKET_REMOVE(b); |
| 396 | APR_BRIGADE_INSERT_TAIL(io->output, b); |
| 397 | io->buffered_len += b->length; |
| 398 | continue; |
| 399 | } |
| 400 | } |
| 401 | else { |
| 402 | /* bucket fits in remain, copy to scratch */ |
| 403 | rv = read_to_scratch(io, b); |
| 404 | apr_bucket_delete(b); |
| 405 | if (APR_SUCCESS != rv) goto cleanup; |
| 406 | continue; |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | cleanup: |
| 411 | return rv; |
| 412 | } |
| 413 | |
| 414 | static apr_status_t c1_in_feed_bucket(h2_session *session, |
| 415 | apr_bucket *b, apr_ssize_t *inout_len) |
no test coverage detected