return sos->prev->read_to(sos->prev, bb, plen, peos);
}
-static apr_status_t h2_sos_h2_status_prep_read(h2_sos *sos, apr_off_t *plen, int *peos)
+static apr_status_t h2_sos_h2_status_prepare(h2_sos *sos, apr_off_t *plen, int *peos)
{
- return sos->prev->prep_read(sos->prev, plen, peos);
+ return sos->prev->prepare(sos->prev, plen, peos);
}
static apr_status_t h2_sos_h2_status_readx(h2_sos *sos, h2_io_data_cb *cb, void *ctx,
sos->response = response;
sos->stream = prev->stream;
sos->buffer = h2_sos_h2_status_buffer;
- sos->prep_read = h2_sos_h2_status_prep_read;
+ sos->prepare = h2_sos_h2_status_prepare;
sos->readx = h2_sos_h2_status_readx;
sos->read_to = h2_sos_h2_status_read_to;
sos->get_trailers = h2_sos_h2_status_get_trailers;
typedef apr_status_t h2_sos_data_cb(void *ctx, const char *data, apr_off_t len);
typedef apr_status_t h2_sos_buffer(h2_sos *sos, apr_bucket_brigade *bb);
-typedef apr_status_t h2_sos_prep_read(h2_sos *sos, apr_off_t *plen, int *peos);
+typedef apr_status_t h2_sos_prepare(h2_sos *sos, apr_off_t *plen, int *peos);
typedef apr_status_t h2_sos_readx(h2_sos *sos, h2_sos_data_cb *cb,
void *ctx, apr_off_t *plen, int *peos);
typedef apr_status_t h2_sos_read_to(h2_sos *sos, apr_bucket_brigade *bb,
struct h2_response *response;
void *ctx;
h2_sos_buffer *buffer;
- h2_sos_prep_read *prep_read;
+ h2_sos_prepare *prepare;
h2_sos_readx *readx;
h2_sos_read_to *read_to;
h2_sos_get_trailers *get_trailers;
AP_DEBUG_ASSERT(stream);
if (h2_stream_is_suspended(stream)) {
- if (h2_mplx_out_has_data_for(stream->session->mplx, stream->id)) {
+ apr_status_t status;
+ apr_off_t len = -1;
+ int eos;
+
+ status = h2_stream_out_prepare(stream, &len, &eos);
+ if (status == APR_SUCCESS) {
int rv;
h2_stream_set_suspended(stream, 0);
++rctx->resume_count;
ap_log_cerror(APLOG_MARK, nghttp2_is_fatal(rv)?
APLOG_ERR : APLOG_DEBUG, 0, session->c,
APLOGNO(02936)
- "h2_stream(%ld-%d): resuming %s",
- session->id, stream->id, rv? nghttp2_strerror(rv) : "");
+ "h2_stream(%ld-%d): resuming %s, len=%ld, eos=%d",
+ session->id, stream->id,
+ rv? nghttp2_strerror(rv) : "", (long)len, eos);
}
}
return 1;
AP_DEBUG_ASSERT(!h2_stream_is_suspended(stream));
- status = h2_stream_prep_read(stream, &nread, &eos);
+ status = h2_stream_out_prepare(stream, &nread, &eos);
if (nread) {
*data_flags |= NGHTTP2_DATA_FLAG_NO_COPY;
}
session->id, (int)stream_id);
return NGHTTP2_ERR_DEFERRED;
- case APR_EOF:
- nread = 0;
- eos = 1;
- break;
-
default:
nread = 0;
ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c,
return stream->suspended;
}
-apr_status_t h2_stream_prep_read(h2_stream *stream,
- apr_off_t *plen, int *peos)
+apr_status_t h2_stream_out_prepare(h2_stream *stream,
+ apr_off_t *plen, int *peos)
{
if (stream->rst_error) {
+ *plen = 0;
+ *peos = 1;
return APR_ECONNRESET;
}
- if (!stream->sos) {
- return APR_EGENERAL;
- }
- return stream->sos->prep_read(stream->sos, plen, peos);
+ AP_DEBUG_ASSERT(stream->sos);
+ return stream->sos->prepare(stream->sos, plen, peos);
}
apr_status_t h2_stream_readx(h2_stream *stream,
}
status = h2_mplx_out_get_brigade(msos->m, stream_id, msos->tmp,
msos->buffer_size-1, &trailers);
- if (status == APR_SUCCESS) {
- status = h2_transfer_brigade(msos->bb, msos->tmp, pool);
+ if (!APR_BRIGADE_EMPTY(msos->tmp)) {
+ h2_transfer_brigade(msos->bb, msos->tmp, pool);
}
if (trailers) {
msos->trailers = trailers;
status = h2_append_brigade(bb, msos->bb, plen, peos);
if (status == APR_SUCCESS && !*peos && !*plen) {
status = APR_EAGAIN;
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, msos->m->c,
+ "h2_stream(%ld-%d): read_to, len=%ld eos=%d",
+ msos->m->id, sos->stream->id, (long)*plen, *peos);
}
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, msos->m->c,
"h2_stream(%ld-%d): read_to, len=%ld eos=%d",
if (status == APR_SUCCESS && !*peos && !*plen) {
status = APR_EAGAIN;
}
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, msos->m->c,
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, msos->m->c,
"h2_stream(%ld-%d): readx, len=%ld eos=%d",
msos->m->id, sos->stream->id, (long)*plen, *peos);
return status;
}
-static apr_status_t h2_sos_mplx_prep_read(h2_sos *sos, apr_off_t *plen, int *peos)
+static apr_status_t h2_sos_mplx_prepare(h2_sos *sos, apr_off_t *plen, int *peos)
{
h2_sos_mplx *msos = sos->ctx;
apr_status_t status = APR_SUCCESS;
- H2_SOS_MPLX_OUT(APLOG_TRACE2, msos, "h2_sos_mplx prep_read_pre");
+ H2_SOS_MPLX_OUT(APLOG_TRACE2, msos, "h2_sos_mplx prepare_pre");
if (APR_BRIGADE_EMPTY(msos->bb)) {
status = mplx_transfer(msos, sos->stream->id, sos->stream->pool);
}
- status = h2_util_bb_avail(msos->bb, plen, peos);
+ h2_util_bb_avail(msos->bb, plen, peos);
- H2_SOS_MPLX_OUT(APLOG_TRACE2, msos, "h2_sos_mplx prep_read_post");
+ H2_SOS_MPLX_OUT(APLOG_TRACE2, msos, "h2_sos_mplx prepare_post");
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, msos->m->c,
- "h2_stream(%ld-%d): prep_read, len=%ld eos=%d, trailers=%s",
+ "h2_stream(%ld-%d): prepare, len=%ld eos=%d, trailers=%s",
msos->m->id, sos->stream->id, (long)*plen, *peos,
msos->trailers? "yes" : "no");
- if (status == APR_SUCCESS && !*peos && !*plen) {
+ if (!*peos && !*plen) {
status = APR_EAGAIN;
}
sos->ctx = msos;
sos->buffer = h2_sos_mplx_buffer;
- sos->prep_read = h2_sos_mplx_prep_read;
+ sos->prepare = h2_sos_mplx_prepare;
sos->readx = h2_sos_mplx_readx;
sos->read_to = h2_sos_mplx_read_to;
sos->get_trailers = h2_sos_mplx_get_trailers;