Loading modules/http2/h2_bucket_eoc.c +2 −1 Original line number Diff line number Diff line Loading @@ -90,10 +90,11 @@ static void bucket_destroy(void *data) if (apr_bucket_shared_destroy(h)) { h2_session *session = h->session; apr_bucket_free(h); if (session) { h2_session_eoc_callback(session); /* all is gone now */ } apr_bucket_free(h); } } Loading modules/http2/h2_config.c +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static h2_config defconf = { H2_INITIAL_WINDOW_SIZE, /* window_size */ -1, /* min workers */ -1, /* max workers */ 10 * 60, /* max workers idle secs */ 10, /* max workers idle secs */ 64 * 1024, /* stream max mem size */ NULL, /* no alt-svcs */ -1, /* alt-svc max age */ Loading modules/http2/h2_conn.c +2 −4 Original line number Diff line number Diff line Loading @@ -177,10 +177,6 @@ apr_status_t h2_conn_process(conn_rec *c, request_rec *r) ap_log_cerror( APLOG_MARK, APLOG_DEBUG, status, session->c, "h2_session(%ld): done", session->id); h2_session_close(session); h2_session_flush(session); /* hereafter session might be gone */ /* Make sure this connection gets closed properly. */ ap_update_child_status_from_conn(c->sbh, SERVER_CLOSING, c); c->keepalive = AP_CONN_CLOSE; Loading @@ -188,6 +184,8 @@ apr_status_t h2_conn_process(conn_rec *c, request_rec *r) c->cs->state = CONN_STATE_WRITE_COMPLETION; } h2_session_close(session); /* hereafter session will be gone */ return status; } Loading modules/http2/h2_conn_io.c +33 −14 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <http_connection.h> #include "h2_private.h" #include "h2_bucket_eoc.h" #include "h2_config.h" #include "h2_conn_io.h" #include "h2_h2.h" Loading @@ -44,20 +45,20 @@ #define WRITE_BUFFER_SIZE (8*WRITE_SIZE_MAX) apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c) apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c, apr_pool_t *pool) { h2_config *cfg = h2_config_get(c); io->connection = c; io->input = apr_brigade_create(c->pool, c->bucket_alloc); io->output = apr_brigade_create(c->pool, c->bucket_alloc); io->input = apr_brigade_create(pool, c->bucket_alloc); io->output = apr_brigade_create(pool, c->bucket_alloc); io->buflen = 0; io->is_tls = h2_h2_is_tls(c); io->buffer_output = io->is_tls; if (io->buffer_output) { io->bufsize = WRITE_BUFFER_SIZE; io->buffer = apr_pcalloc(c->pool, io->bufsize); io->buffer = apr_pcalloc(pool, io->bufsize); } else { io->bufsize = 0; Loading Loading @@ -115,6 +116,8 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, &bucket_length, block); if (status == APR_SUCCESS && bucket_length > 0) { apr_size_t consumed = 0; if (APLOGctrace2(io->connection)) { char buffer[32]; h2_util_hex_dump(buffer, sizeof(buffer)/sizeof(buffer[0]), Loading @@ -124,10 +127,8 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, io->connection->id, (int)bucket_length, buffer); } if (bucket_length > 0) { apr_size_t consumed = 0; status = on_read_cb(bucket_data, bucket_length, &consumed, pdone, puser); status = on_read_cb(bucket_data, bucket_length, &consumed, pdone, puser); if (status == APR_SUCCESS && bucket_length > consumed) { /* We have data left in the bucket. Split it. */ status = apr_bucket_split(bucket, consumed); Loading @@ -135,9 +136,9 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, readlen += consumed; } } } apr_bucket_delete(bucket); } if (readlen == 0 && status == APR_SUCCESS && block == APR_NONBLOCK_READ) { return APR_EAGAIN; } Loading @@ -158,10 +159,10 @@ apr_status_t h2_conn_io_read(h2_conn_io *io, /* Seems something is left from a previous read, lets * satisfy our caller with the data we already have. */ status = h2_conn_io_bucket_read(io, block, on_read_cb, puser, &done); apr_brigade_cleanup(io->input); if (status != APR_SUCCESS || done) { return status; } apr_brigade_cleanup(io->input); } /* We only do a blocking read when we have no streams to process. So, Loading @@ -179,6 +180,9 @@ apr_status_t h2_conn_io_read(h2_conn_io *io, ap_update_child_status(io->connection->sbh, SERVER_BUSY_READ, NULL); } /* TODO: replace this with a connection filter itself, so that we * no longer need to transfer incoming buckets to our own brigade. */ status = ap_get_brigade(io->connection->input_filters, io->input, AP_MODE_READBYTES, block, 64 * 4096); Loading Loading @@ -380,3 +384,18 @@ apr_status_t h2_conn_io_pass(h2_conn_io *io) { return h2_conn_io_flush_int(io, 0); } apr_status_t h2_conn_io_close(h2_conn_io *io, void *session) { apr_bucket *b; /* Send out anything in our buffers */ h2_conn_io_flush_int(io, 0); b = h2_bucket_eoc_create(io->connection->bucket_alloc, session); APR_BRIGADE_INSERT_TAIL(io->output, b); b = apr_bucket_flush_create(io->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(io->output, b); return ap_pass_brigade(io->connection->output_filters, io->output); /* and all is gone */ } No newline at end of file modules/http2/h2_conn_io.h +2 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ typedef struct { int unflushed; } h2_conn_io; apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c); apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c, apr_pool_t *pool); int h2_conn_io_is_buffered(h2_conn_io *io); Loading @@ -65,5 +65,6 @@ apr_status_t h2_conn_io_consider_flush(h2_conn_io *io); apr_status_t h2_conn_io_pass(h2_conn_io *io); apr_status_t h2_conn_io_flush(h2_conn_io *io); apr_status_t h2_conn_io_close(h2_conn_io *io, void *session); #endif /* defined(__mod_h2__h2_conn_io__) */ Loading
modules/http2/h2_bucket_eoc.c +2 −1 Original line number Diff line number Diff line Loading @@ -90,10 +90,11 @@ static void bucket_destroy(void *data) if (apr_bucket_shared_destroy(h)) { h2_session *session = h->session; apr_bucket_free(h); if (session) { h2_session_eoc_callback(session); /* all is gone now */ } apr_bucket_free(h); } } Loading
modules/http2/h2_config.c +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ static h2_config defconf = { H2_INITIAL_WINDOW_SIZE, /* window_size */ -1, /* min workers */ -1, /* max workers */ 10 * 60, /* max workers idle secs */ 10, /* max workers idle secs */ 64 * 1024, /* stream max mem size */ NULL, /* no alt-svcs */ -1, /* alt-svc max age */ Loading
modules/http2/h2_conn.c +2 −4 Original line number Diff line number Diff line Loading @@ -177,10 +177,6 @@ apr_status_t h2_conn_process(conn_rec *c, request_rec *r) ap_log_cerror( APLOG_MARK, APLOG_DEBUG, status, session->c, "h2_session(%ld): done", session->id); h2_session_close(session); h2_session_flush(session); /* hereafter session might be gone */ /* Make sure this connection gets closed properly. */ ap_update_child_status_from_conn(c->sbh, SERVER_CLOSING, c); c->keepalive = AP_CONN_CLOSE; Loading @@ -188,6 +184,8 @@ apr_status_t h2_conn_process(conn_rec *c, request_rec *r) c->cs->state = CONN_STATE_WRITE_COMPLETION; } h2_session_close(session); /* hereafter session will be gone */ return status; } Loading
modules/http2/h2_conn_io.c +33 −14 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <http_connection.h> #include "h2_private.h" #include "h2_bucket_eoc.h" #include "h2_config.h" #include "h2_conn_io.h" #include "h2_h2.h" Loading @@ -44,20 +45,20 @@ #define WRITE_BUFFER_SIZE (8*WRITE_SIZE_MAX) apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c) apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c, apr_pool_t *pool) { h2_config *cfg = h2_config_get(c); io->connection = c; io->input = apr_brigade_create(c->pool, c->bucket_alloc); io->output = apr_brigade_create(c->pool, c->bucket_alloc); io->input = apr_brigade_create(pool, c->bucket_alloc); io->output = apr_brigade_create(pool, c->bucket_alloc); io->buflen = 0; io->is_tls = h2_h2_is_tls(c); io->buffer_output = io->is_tls; if (io->buffer_output) { io->bufsize = WRITE_BUFFER_SIZE; io->buffer = apr_pcalloc(c->pool, io->bufsize); io->buffer = apr_pcalloc(pool, io->bufsize); } else { io->bufsize = 0; Loading Loading @@ -115,6 +116,8 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, &bucket_length, block); if (status == APR_SUCCESS && bucket_length > 0) { apr_size_t consumed = 0; if (APLOGctrace2(io->connection)) { char buffer[32]; h2_util_hex_dump(buffer, sizeof(buffer)/sizeof(buffer[0]), Loading @@ -124,10 +127,8 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, io->connection->id, (int)bucket_length, buffer); } if (bucket_length > 0) { apr_size_t consumed = 0; status = on_read_cb(bucket_data, bucket_length, &consumed, pdone, puser); status = on_read_cb(bucket_data, bucket_length, &consumed, pdone, puser); if (status == APR_SUCCESS && bucket_length > consumed) { /* We have data left in the bucket. Split it. */ status = apr_bucket_split(bucket, consumed); Loading @@ -135,9 +136,9 @@ static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io, readlen += consumed; } } } apr_bucket_delete(bucket); } if (readlen == 0 && status == APR_SUCCESS && block == APR_NONBLOCK_READ) { return APR_EAGAIN; } Loading @@ -158,10 +159,10 @@ apr_status_t h2_conn_io_read(h2_conn_io *io, /* Seems something is left from a previous read, lets * satisfy our caller with the data we already have. */ status = h2_conn_io_bucket_read(io, block, on_read_cb, puser, &done); apr_brigade_cleanup(io->input); if (status != APR_SUCCESS || done) { return status; } apr_brigade_cleanup(io->input); } /* We only do a blocking read when we have no streams to process. So, Loading @@ -179,6 +180,9 @@ apr_status_t h2_conn_io_read(h2_conn_io *io, ap_update_child_status(io->connection->sbh, SERVER_BUSY_READ, NULL); } /* TODO: replace this with a connection filter itself, so that we * no longer need to transfer incoming buckets to our own brigade. */ status = ap_get_brigade(io->connection->input_filters, io->input, AP_MODE_READBYTES, block, 64 * 4096); Loading Loading @@ -380,3 +384,18 @@ apr_status_t h2_conn_io_pass(h2_conn_io *io) { return h2_conn_io_flush_int(io, 0); } apr_status_t h2_conn_io_close(h2_conn_io *io, void *session) { apr_bucket *b; /* Send out anything in our buffers */ h2_conn_io_flush_int(io, 0); b = h2_bucket_eoc_create(io->connection->bucket_alloc, session); APR_BRIGADE_INSERT_TAIL(io->output, b); b = apr_bucket_flush_create(io->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(io->output, b); return ap_pass_brigade(io->connection->output_filters, io->output); /* and all is gone */ } No newline at end of file
modules/http2/h2_conn_io.h +2 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ typedef struct { int unflushed; } h2_conn_io; apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c); apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c, apr_pool_t *pool); int h2_conn_io_is_buffered(h2_conn_io *io); Loading @@ -65,5 +65,6 @@ apr_status_t h2_conn_io_consider_flush(h2_conn_io *io); apr_status_t h2_conn_io_pass(h2_conn_io *io); apr_status_t h2_conn_io_flush(h2_conn_io *io); apr_status_t h2_conn_io_close(h2_conn_io *io, void *session); #endif /* defined(__mod_h2__h2_conn_io__) */