#include "h2_util.h"
-static h2_mpm_type_t mpm_type = H2_MPM_UNKNOWN;
static module *mpm_module;
static int mpm_supported = 1;
static apr_socket_t *dummy_socket;
module *m = ap_loaded_modules[i];
if (!strcmp("event.c", m->name)) {
- mpm_type = H2_MPM_EVENT;
mpm_module = m;
break;
}
else if (!strcmp("motorz.c", m->name)) {
- mpm_type = H2_MPM_MOTORZ;
mpm_module = m;
break;
}
else if (!strcmp("mpm_netware.c", m->name)) {
- mpm_type = H2_MPM_NETWARE;
mpm_module = m;
break;
}
else if (!strcmp("prefork.c", m->name)) {
- mpm_type = H2_MPM_PREFORK;
mpm_module = m;
/* While http2 can work really well on prefork, it collides
* today's use case for prefork: running single-thread app engines
break;
}
else if (!strcmp("simple_api.c", m->name)) {
- mpm_type = H2_MPM_SIMPLE;
mpm_module = m;
mpm_supported = 0;
break;
}
else if (!strcmp("mpm_winnt.c", m->name)) {
- mpm_type = H2_MPM_WINNT;
mpm_module = m;
break;
}
else if (!strcmp("worker.c", m->name)) {
- mpm_type = H2_MPM_WORKER;
mpm_module = m;
break;
}
}
}
-h2_mpm_type_t h2_conn_mpm_type(void)
-{
- check_modules(0);
- return mpm_type;
-}
-
const char *h2_conn_mpm_name(void)
{
check_modules(0);
h2_conn_ctx_t *conn_ctx;
h2_c2_fctx_in_t *fctx = f->ctx;
apr_status_t status = APR_SUCCESS;
- apr_bucket *b, *next;
+ apr_bucket *b;
apr_off_t bblen;
const int trace1 = APLOGctrace1(f->c);
apr_size_t rmax = ((readbytes <= APR_SIZE_MAX)?
conn_ctx = h2_conn_ctx_get(f->c);
ap_assert(conn_ctx);
- if (trace1) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
- "h2_c2_in(%s-%d): read, mode=%d, block=%d, readbytes=%ld",
- conn_ctx->id, conn_ctx->stream_id, mode, block, (long)readbytes);
- }
-
if (mode == AP_MODE_INIT) {
return ap_get_brigade(f->c->input_filters, bb, mode, block, readbytes);
}
return APR_ECONNABORTED;
}
+ if (APLOGctrace1(f->c)) {
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
+ "h2_c2_in(%s-%d): read, mode=%d, block=%d, readbytes=%ld",
+ conn_ctx->id, conn_ctx->stream_id, mode, block, (long)readbytes);
+ }
+
if (!fctx) {
fctx = apr_pcalloc(f->c->pool, sizeof(*fctx));
f->ctx = fctx;
}
}
- /* Cleanup brigades from those nasty 0 length non-meta buckets
- * that apr_brigade_split_line() sometimes produces. */
- for (b = APR_BRIGADE_FIRST(fctx->bb);
- b != APR_BRIGADE_SENTINEL(fctx->bb); b = next) {
- next = APR_BUCKET_NEXT(b);
- if (b->length == 0 && !APR_BUCKET_IS_METADATA(b)) {
- apr_bucket_delete(b);
- }
- }
-
while (APR_BRIGADE_EMPTY(fctx->bb)) {
/* Get more input data for our request. */
- if (trace1) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
+ if (APLOGctrace1(f->c)) {
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, f->c,
"h2_c2_in(%s-%d): get more data from mplx, block=%d, "
"readbytes=%ld",
conn_ctx->id, conn_ctx->stream_id, block, (long)readbytes);
status = APR_EOF;
}
- if (trace1) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE2, status, f->c,
+ if (APLOGctrace3(f->c)) {
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, f->c,
"h2_c2_in(%s-%d): read returned",
conn_ctx->id, conn_ctx->stream_id);
}
return status;
}
- if (trace1) {
- h2_util_bb_log(f->c, conn_ctx->stream_id, APLOG_TRACE2,
+ if (APLOGctrace3(f->c)) {
+ h2_util_bb_log(f->c, conn_ctx->stream_id, APLOG_TRACE3,
"c2 input recv raw", fctx->bb);
}
if (h2_c_logio_add_bytes_in) {
}
if (APR_BRIGADE_EMPTY(fctx->bb)) {
- if (trace1) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
+ if (APLOGctrace3(f->c)) {
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, f->c,
"h2_c2_in(%s-%d): no data",
conn_ctx->id, conn_ctx->stream_id);
}
* though it ends with CRLF and creates a 0 length bucket */
status = apr_brigade_split_line(bb, fctx->bb, block,
HUGE_STRING_LEN);
- if (APLOGctrace1(f->c)) {
+ if (APLOGctrace3(f->c)) {
char buffer[1024];
apr_size_t len = sizeof(buffer)-1;
apr_brigade_flatten(bb, buffer, &len);
buffer[len] = 0;
- if (trace1) {
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
- "h2_c2_in(%s-%d): getline: %s",
- conn_ctx->id, conn_ctx->stream_id, buffer);
- }
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, f->c,
+ "h2_c2_in(%s-%d): getline: %s",
+ conn_ctx->id, conn_ctx->stream_id, buffer);
}
}
else {
status = APR_ENOTIMPL;
}
- if (trace1) {
+ if (APLOGctrace3(f->c)) {
apr_brigade_length(bb, 0, &bblen);
- ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
+ ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, f->c,
"h2_c2_in(%s-%d): %ld data bytes",
conn_ctx->id, conn_ctx->stream_id, (long)bblen);
}
static int h2_c2_hook_fixups(request_rec *r)
{
- /* secondary connection? */
- if (r->connection->master) {
- h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(r->connection);
- if (conn_ctx) {
- check_push(r, "late_fixup");
- }
+ conn_rec *c2 = r->connection;
+ h2_conn_ctx_t *conn_ctx;
+
+ if (!c2->master || !(conn_ctx = h2_conn_ctx_get(c2)) || !conn_ctx->stream_id) {
+ return DECLINED;
}
+
+ check_push(r, "late_fixup");
+
return DECLINED;
}