Skip to content

Commit

Permalink
v1.9.1 from apache svn
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Eissing committed Feb 22, 2017
1 parent c47e682 commit 6ce49ed
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 24 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.9.1
--------------------------------------------------------------------------------
* mod_proxy_http2: support for ProxyPreserveHost directive

v1.9.0
--------------------------------------------------------------------------------
* not counting file buckets again stream max buffer limits.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

AC_PREREQ([2.69])
AC_INIT([mod_http2], [1.9.0], [[email protected]])
AC_INIT([mod_http2], [1.9.1], [[email protected]])

LT_PREREQ([2.2.6])
LT_INIT()
Expand Down
20 changes: 16 additions & 4 deletions mod_http2/h2_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <http_protocol.h>
#include <http_request.h>

#include <mpm_common.h>

#include "h2_private.h"
#include "h2.h"
#include "h2_config.h"
Expand Down Expand Up @@ -253,6 +255,7 @@ apr_status_t h2_conn_pre_close(struct h2_ctx *ctx, conn_rec *c)
conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent)
{
apr_allocator_t *allocator;
apr_status_t status;
apr_pool_t *pool;
conn_rec *c;
void *cfg;
Expand All @@ -265,18 +268,27 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent)
/* We create a pool with its own allocator to be used for
* processing a request. This is the only way to have the processing
* independant of its parent pool in the sense that it can work in
* another thread.
* another thread. Also, the new allocator needs its own mutex to
* synchronize sub-pools.
*/
apr_allocator_create(&allocator);
apr_pool_create_ex(&pool, parent, NULL, allocator);
apr_pool_tag(pool, "h2_slave_conn");
apr_allocator_max_free_set(allocator, ap_max_mem_free);
status = apr_pool_create_ex(&pool, parent, NULL, allocator);
if (status != APR_SUCCESS) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, status, master,
APLOGNO(10004) "h2_session(%ld-%d): create slave pool",
master->id, slave_id);
return NULL;
}
apr_allocator_owner_set(allocator, pool);

apr_pool_tag(pool, "h2_slave_conn");

c = (conn_rec *) apr_palloc(pool, sizeof(conn_rec));
if (c == NULL) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_ENOMEM, master,
APLOGNO(02913) "h2_session(%ld-%d): create slave",
master->id, slave_id);
apr_pool_destroy(pool);
return NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_conn_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ static void h2_conn_io_bb_log(conn_rec *c, int stream_id, int level,
line = *buffer? buffer : "(empty)";
}
/* Intentional no APLOGNO */
ap_log_cerror(APLOG_MARK, level, 0, c, "h2_session(%s)-%s: %s",
c->log_id, tag, line);
ap_log_cerror(APLOG_MARK, level, 0, c, "h2_session(%ld)-%s: %s",
c->id, tag, line);

}

Expand Down
35 changes: 27 additions & 8 deletions mod_http2/h2_mplx.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <http_core.h>
#include <http_log.h>

#include <mpm_common.h>

#include "mod_http2.h"

#include "h2.h"
Expand Down Expand Up @@ -232,39 +234,56 @@ h2_mplx *h2_mplx_create(conn_rec *c, apr_pool_t *parent,
h2_workers *workers)
{
apr_status_t status = APR_SUCCESS;
apr_allocator_t *allocator = NULL;
apr_allocator_t *allocator;
apr_thread_mutex_t *mutex;
h2_mplx *m;
ap_assert(conf);

status = apr_allocator_create(&allocator);
if (status != APR_SUCCESS) {
return NULL;
}

m = apr_pcalloc(parent, sizeof(h2_mplx));
if (m) {
m->id = c->id;
APR_RING_ELEM_INIT(m, link);
m->c = c;

/* We create a pool with its own allocator to be used for
* processing slave connections. This is the only way to have the
* processing independant of its parent pool in the sense that it
* can work in another thread. Also, the new allocator needs its own
* mutex to synchronize sub-pools.
*/
status = apr_allocator_create(&allocator);
if (status != APR_SUCCESS) {
return NULL;
}
apr_allocator_max_free_set(allocator, ap_max_mem_free);
apr_pool_create_ex(&m->pool, parent, NULL, allocator);
if (!m->pool) {
apr_allocator_destroy(allocator);
return NULL;
}
apr_pool_tag(m->pool, "h2_mplx");
apr_allocator_owner_set(allocator, m->pool);

status = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT,
m->pool);
if (status != APR_SUCCESS) {
apr_pool_destroy(m->pool);
return NULL;
}
apr_allocator_mutex_set(allocator, mutex);

status = apr_thread_mutex_create(&m->lock, APR_THREAD_MUTEX_DEFAULT,
m->pool);
if (status != APR_SUCCESS) {
apr_pool_destroy(m->pool);
return NULL;
}

status = apr_thread_cond_create(&m->task_thawed, m->pool);
if (status != APR_SUCCESS) {
apr_pool_destroy(m->pool);
return NULL;
}

m->bucket_alloc = apr_bucket_alloc_create(m->pool);
m->max_streams = h2_config_geti(conf, H2_CONF_MAX_STREAMS);
m->stream_max_mem = h2_config_geti(conf, H2_CONF_STREAM_MAX_MEM);

Expand Down
1 change: 0 additions & 1 deletion mod_http2/h2_mplx.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct h2_mplx {
long id;
conn_rec *c;
apr_pool_t *pool;
apr_bucket_alloc_t *bucket_alloc;

APR_RING_ENTRY(h2_mplx) link;

Expand Down
21 changes: 15 additions & 6 deletions mod_http2/h2_proxy_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
apr_uri_t puri;
const char *authority, *scheme, *path;
apr_status_t status;
proxy_dir_conf *dconf;

stream = apr_pcalloc(r->pool, sizeof(*stream));

Expand All @@ -715,14 +716,22 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
status = apr_uri_parse(stream->pool, url, &puri);
if (status != APR_SUCCESS)
return status;

scheme = (strcmp(puri.scheme, "h2")? "http" : "https");
authority = puri.hostname;
if (!ap_strchr_c(authority, ':') && puri.port
&& apr_uri_port_of_scheme(scheme) != puri.port) {
/* port info missing and port is not default for scheme: append */
authority = apr_psprintf(stream->pool, "%s:%d", authority, puri.port);

dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
if (dconf->preserve_host) {
authority = r->hostname;
}
else {
authority = puri.hostname;
if (!ap_strchr_c(authority, ':') && puri.port
&& apr_uri_port_of_scheme(scheme) != puri.port) {
/* port info missing and port is not default for scheme: append */
authority = apr_psprintf(stream->pool, "%s:%d", authority, puri.port);
}
}

/* we need this for mapping relative uris in headers ("Link") back
* to local uris */
stream->real_server_uri = apr_psprintf(stream->pool, "%s://%s", scheme, authority);
Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
* @macro
* Version number of the http2 module as c string
*/
#define MOD_HTTP2_VERSION "1.9.0-git"
#define MOD_HTTP2_VERSION "1.9.1-git"

/**
* @macro
* Numerical representation of the version number of the http2 module
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define MOD_HTTP2_VERSION_NUM 0x010900
#define MOD_HTTP2_VERSION_NUM 0x010901


#endif /* mod_h2_h2_version_h */
4 changes: 4 additions & 0 deletions mod_http2/mod_proxy_http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ static int proxy_http2_handler(request_rec *r,
/* New conection: set a note on the connection what CN is
* requested and what protocol we want */
if (ctx->p_conn->ssl_hostname) {
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, ctx->owner,
"set SNI to %s for (%s)",
ctx->p_conn->ssl_hostname,
ctx->p_conn->hostname);
apr_table_setn(ctx->p_conn->connection->notes,
"proxy-request-hostname", ctx->p_conn->ssl_hostname);
}
Expand Down

0 comments on commit 6ce49ed

Please sign in to comment.