in buckets/event_buckets.c [57:102]
static apr_status_t serf_event_read(serf_bucket_t *bucket,
apr_size_t requested,
const char **data,
apr_size_t *len)
{
event_context_t *ctx = bucket->data;
apr_status_t status;
if (ctx->start_cb) {
status = ctx->start_cb(ctx->baton, ctx->bytes_read);
ctx->start_cb = NULL;
if (SERF_BUCKET_READ_ERROR(status))
return status;
}
if (ctx->stream && !ctx->at_eof) {
status = serf_bucket_read(ctx->stream, requested, data, len);
}
else {
status = APR_EOF;
*data = NULL;
*len = 0;
if (ctx->at_eof && ctx->stream) {
serf_bucket_destroy(ctx->stream);
ctx->stream = NULL;
}
}
if (!SERF_BUCKET_READ_ERROR(status)) {
ctx->bytes_read += *len;
if (APR_STATUS_IS_EOF(status)) {
ctx->at_eof = true;
if (ctx->eof_cb) {
status = ctx->eof_cb(ctx->baton, ctx->bytes_read);
ctx->eof_cb = NULL;
status = SERF_BUCKET_READ_ERROR(status) ? status : APR_EOF;
}
}
}
return status;
}