return inl;
}
+/* This function will read from a brigade and discard the read buckets as it
+ * proceeds. It will read at most *len bytes.
+ */
static apr_status_t brigade_consume(apr_bucket_brigade *bb,
apr_read_type_e block,
char *c, apr_size_t *len)
*len = 0;
+ /* If we have something leftover from last time, try that first. */
if ((bytes = char_buffer_read(&inctx->cbuf, buf, wanted))) {
*len = bytes;
if (inctx->mode == AP_MODE_SPECULATIVE) {
if (rc > 0) {
*len += rc;
if (inctx->mode == AP_MODE_SPECULATIVE) {
+ /* We want to rollback this read. */
char_buffer_write(&inctx->cbuf, buf, rc);
}
return inctx->rc;
if (APR_STATUS_IS_EAGAIN(inctx->rc)
|| APR_STATUS_IS_EINTR(inctx->rc)) {
if (inctx->block == APR_NONBLOCK_READ) {
+ /* Already read something, return APR_SUCCESS instead. */
if (*len > 0) {
inctx->rc = APR_SUCCESS;
}
inctx->rc = APR_EAGAIN;
if (inctx->block == APR_NONBLOCK_READ) {
+ /* Already read something, return APR_SUCCESS instead. */
if (*len > 0) {
inctx->rc = APR_SUCCESS;
}
return ssl_io_filter_error(f, bb, status);
}
+ /* Create a transient bucket out of the decrypted data. */
if (len > 0) {
apr_bucket *bucket =
apr_bucket_transient_create(inctx->buffer, len, f->c->bucket_alloc);