View | Details | Raw Unified | Return to bug 61222
Collapse All | Expand All

(-)server/protocol.c (-25 / +24 lines)
Lines 1725-1764 Link Here
1725
             * prior to this, and then read the data for this bucket.
1725
             * prior to this, and then read the data for this bucket.
1726
             */
1726
             */
1727
            rv = apr_bucket_read(e, &ignored, &len, eblock);
1727
            rv = apr_bucket_read(e, &ignored, &len, eblock);
1728
            if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
1729
                ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00574)
1730
                              "ap_content_length_filter: "
1731
                              "apr_bucket_read() failed");
1732
                return rv;
1733
            }
1728
            if (rv == APR_SUCCESS) {
1734
            if (rv == APR_SUCCESS) {
1735
                /* include just read bucket in flush */
1736
                e = APR_BUCKET_NEXT(e);
1729
                /* Attempt a nonblocking read next time through */
1737
                /* Attempt a nonblocking read next time through */
1730
                eblock = APR_NONBLOCK_READ;
1738
                eblock = APR_NONBLOCK_READ;
1731
                r->bytes_sent += len;
1739
                r->bytes_sent += len;
1732
            }
1740
            }
1733
            else if (APR_STATUS_IS_EAGAIN(rv)) {
1741
            else if (APR_STATUS_IS_EAGAIN(rv)) {
1734
                /* Output everything prior to this bucket, and then
1742
                eblock = APR_BLOCK_READ;
1735
                 * do a blocking read on the next batch.
1743
            }
1736
                 */
1744
            /* Output everything prior to this bucket, and then
1737
                if (e != APR_BRIGADE_FIRST(b)) {
1745
             * do a blocking read on the next batch.
1738
                    apr_bucket *flush;
1746
             */
1739
                    apr_brigade_split_ex(b, e, ctx->tmpbb);
1747
            if (e != APR_BRIGADE_FIRST(b)) {
1740
                    flush = apr_bucket_flush_create(r->connection->bucket_alloc);
1748
                apr_brigade_split_ex(b, e, ctx->tmpbb);
1741
1749
1742
                    APR_BRIGADE_INSERT_TAIL(b, flush);
1750
                rv = ap_pass_brigade(f->next, b);
1743
                    rv = ap_pass_brigade(f->next, b);
1751
                if (rv != APR_SUCCESS || f->c->aborted) {
1744
                    if (rv != APR_SUCCESS || f->c->aborted) {
1752
                    return rv;
1745
                        return rv;
1753
                }
1746
                    }
1754
                apr_brigade_cleanup(b);
1747
                    apr_brigade_cleanup(b);
1755
                APR_BRIGADE_CONCAT(b, ctx->tmpbb);
1748
                    APR_BRIGADE_CONCAT(b, ctx->tmpbb);
1756
                e = APR_BRIGADE_FIRST(b);
1749
                    e = APR_BRIGADE_FIRST(b);
1750
1757
1751
                    ctx->data_sent = 1;
1758
                ctx->data_sent = 1;
1752
                }
1753
                eblock = APR_BLOCK_READ;
1754
                continue;
1755
            }
1759
            }
1756
            else {
1760
            continue;
1757
                ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00574)
1758
                              "ap_content_length_filter: "
1759
                              "apr_bucket_read() failed");
1760
                return rv;
1761
            }
1762
        }
1761
        }
1763
        else {
1762
        else {
1764
            r->bytes_sent += e->length;
1763
            r->bytes_sent += e->length;

Return to bug 61222