rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
APR_BLOCK_READ, 0);
- if (rv != APR_SUCCESS) {
- return rv;
+ if (rv == APR_SUCCESS) {
+ rv = apr_brigade_flatten(bb, line, &len);
+ if (rv == APR_SUCCESS) {
+ ctx->remaining = get_chunk_size(line);
+ }
}
- apr_brigade_flatten(bb, line, &len);
-
- ctx->remaining = get_chunk_size(line);
/* Detect chunksize error (such as overflow) */
- if (ctx->remaining < 0) {
+ if (rv != APR_SUCCESS || ctx->remaining < 0) {
ctx->remaining = 0; /* Reset it in case we have to
* come back here later */
apr_brigade_cleanup(bb);
/* We need to read the CRLF after the chunk. */
rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
APR_BLOCK_READ, 0);
- if (rv != APR_SUCCESS) {
- return rv;
- }
apr_brigade_cleanup(bb);
- /* Read the real chunk line. */
- rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
- APR_BLOCK_READ, 0);
-
- if (rv != APR_SUCCESS) {
- return rv;
+ if (rv == APR_SUCCESS) {
+ /* Read the real chunk line. */
+ rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
+ APR_BLOCK_READ, 0);
+ if (rv == APR_SUCCESS) {
+ rv = apr_brigade_flatten(bb, line, &len);
+ if (rv == APR_SUCCESS) {
+ ctx->remaining = get_chunk_size(line);
+ }
+ }
}
- apr_brigade_flatten(bb, line, &len);
- ctx->remaining = get_chunk_size(line);
/* Detect chunksize error (such as overflow) */
- if (ctx->remaining < 0) {
+ if (rv != APR_SUCCESS || ctx->remaining < 0) {
ctx->remaining = 0; /* Reset it in case we have to
* come back here later */
apr_brigade_cleanup(bb);
/* read up to the amount they specified. */
if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) {
- apr_off_t total;
apr_bucket *e;
apr_bucket_brigade *newbb;
readbytes = len;
}
- apr_brigade_partition(ctx->b, readbytes, &e);
+ rv = apr_brigade_partition(ctx->b, readbytes, &e);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
/* Must do split before CONCAT */
newbb = apr_brigade_split(ctx->b, e);
/* Take what was originally there and place it back on ctx->b */
APR_BRIGADE_CONCAT(ctx->b, newbb);
- /* XXX: Why is this here? We never use 'total'! */
- apr_brigade_length(b, 1, &total);
-
return APR_SUCCESS;
}