-*- coding: utf-8 -*-
Changes with Apache 2.5.0
+ *) mod_proxy_http2: fixed duplicate symbols with mod_http2.
+
*) mod_dav: Fix a potential cause of unbounded memory usage or incorrect
behavior in a routine that sends <DAV:response>'s to the output filters.
[Evgeny Kotkov]
@echo $(DL) h2_log2,$(DL) >> $@
@echo $(DL) h2_proxy_res_ignore_header,$(DL) >> $@
@echo $(DL) h2_headers_add_h1,$(DL) >> $@
- @echo $(DL) h2_req_create,$(DL) >> $@
- @echo $(DL) h2_req_createn,$(DL) >> $@
- @echo $(DL) h2_util_camel_case_header,$(DL) >> $@
- @echo $(DL) h2_util_frame_print,$(DL) >> $@
- @echo $(DL) h2_util_ngheader_make_req,$(DL) >> $@
@echo $(DL) nghttp2_is_fatal,$(DL) >> $@
@echo $(DL) nghttp2_option_del,$(DL) >> $@
@echo $(DL) nghttp2_option_new,$(DL) >> $@
const char *url;
request_rec *r;
- h2_request *req;
+ h2_proxy_request *req;
int standalone;
h2_stream_state_t state;
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c,
"proxy_session(%s): pool cleanup, state=%d, streams=%d",
session->id, session->state,
- (int)h2_ihash_count(session->streams));
+ (int)h2_proxy_ihash_count(session->streams));
session->aborted = 1;
dispatch_event(session, H2_PROXYS_EV_PRE_CLOSE, 0, NULL);
nghttp2_session_del(session->ngh2);
if (APLOGcdebug(session->c)) {
char buffer[256];
- h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
+ h2_proxy_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03341)
"h2_proxy_session(%s): recv FRAME[%s]",
session->id, buffer);
if (APLOGcdebug(session->c)) {
char buffer[256];
- h2_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
+ h2_proxy_util_frame_print(frame, buffer, sizeof(buffer)/sizeof(buffer[0]));
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03343)
"h2_proxy_session(%s): sent FRAME[%s]",
session->id, buffer);
char *hname, *hvalue;
hname = apr_pstrndup(stream->pool, n, nlen);
- h2_util_camel_case_header(hname, nlen);
+ h2_proxy_util_camel_case_header(hname, nlen);
hvalue = apr_pstrndup(stream->pool, v, vlen);
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, stream->session->c,
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03360)
"h2_proxy_session(%s): stream=%d, closed, err=%d",
session->id, stream_id, error_code);
- stream = h2_ihash_get(session->streams, stream_id);
+ stream = h2_proxy_ihash_get(session->streams, stream_id);
if (stream) {
stream->error_code = error_code;
}
"h2_proxy_stream(%s-%d): suspending",
stream->session->id, stream_id);
stream->suspended = 1;
- h2_iq_add(stream->session->suspended, stream->id, NULL, NULL);
+ h2_proxy_iq_add(stream->session->suspended, stream->id, NULL, NULL);
return NGHTTP2_ERR_DEFERRED;
}
else {
session->state = H2_PROXYS_ST_INIT;
session->window_bits_stream = window_bits_stream;
session->window_bits_connection = window_bits_connection;
- session->streams = h2_ihash_create(pool, offsetof(h2_proxy_stream, id));
- session->suspended = h2_iq_create(pool, 5);
+ session->streams = h2_proxy_ihash_create(pool, offsetof(h2_proxy_stream, id));
+ session->suspended = h2_proxy_iq_create(pool, 5);
session->done = done;
session->input = apr_brigade_create(session->pool, session->c->bucket_alloc);
stream->input = apr_brigade_create(stream->pool, session->c->bucket_alloc);
stream->output = apr_brigade_create(stream->pool, session->c->bucket_alloc);
- stream->req = h2_req_create(1, stream->pool, 0);
+ stream->req = h2_proxy_req_create(1, stream->pool, 0);
status = apr_uri_parse(stream->pool, url, &puri);
if (status != APR_SUCCESS)
authority = apr_psprintf(stream->pool, "%s:%d", authority, puri.port);
}
path = apr_uri_unparse(stream->pool, &puri, APR_URI_UNP_OMITSITEPART);
- h2_req_make(stream->req, stream->pool, r->method, scheme,
+ h2_proxy_req_make(stream->req, stream->pool, r->method, scheme,
authority, path, r->headers_in);
/* Tuck away all already existing cookies */
static apr_status_t submit_stream(h2_proxy_session *session, h2_proxy_stream *stream)
{
- h2_ngheader *hd;
+ h2_proxy_ngheader *hd;
nghttp2_data_provider *pp = NULL;
nghttp2_data_provider provider;
int rv;
if (rv > 0) {
stream->id = rv;
stream->state = H2_STREAM_ST_OPEN;
- h2_ihash_add(session->streams, stream);
+ h2_proxy_ihash_add(session->streams, stream);
dispatch_event(session, H2_PROXYS_EV_STREAM_SUBMITTED, rv, NULL);
return APR_SUCCESS;
"h2_proxy_stream(%s-%d): resuming",
session->id, stream_id);
stream->suspended = 0;
- h2_iq_remove(session->suspended, stream_id);
+ h2_proxy_iq_remove(session->suspended, stream_id);
nghttp2_session_resume_data(session->ngh2, stream_id);
dispatch_event(session, H2_PROXYS_EV_STREAM_RESUMED, 0, NULL);
check_suspended(session);
ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, session->c,
APLOGNO(03382) "h2_proxy_stream(%s-%d): check input",
session->id, stream_id);
- h2_iq_remove(session->suspended, stream_id);
+ h2_proxy_iq_remove(session->suspended, stream_id);
dispatch_event(session, H2_PROXYS_EV_STREAM_RESUMED, 0, NULL);
check_suspended(session);
return APR_SUCCESS;
}
else {
/* gone? */
- h2_iq_remove(session->suspended, stream_id);
+ h2_proxy_iq_remove(session->suspended, stream_id);
check_suspended(session);
return APR_SUCCESS;
}
{
switch (session->state) {
case H2_PROXYS_ST_INIT:
- if (h2_ihash_empty(session->streams)) {
+ if (h2_proxy_ihash_empty(session->streams)) {
transit(session, "init", H2_PROXYS_ST_IDLE);
}
else {
* CPU cycles. Ideally, we'd like to do a blocking read, but that
* is not possible if we have scheduled tasks and wait
* for them to produce something. */
- if (h2_ihash_empty(session->streams)) {
+ if (h2_proxy_ihash_empty(session->streams)) {
if (!is_accepting_streams(session)) {
/* We are no longer accepting new streams and have
* finished processing existing ones. Time to leave. */
}
stream->state = H2_STREAM_ST_CLOSED;
- h2_ihash_remove(session->streams, stream_id);
- h2_iq_remove(session->suspended, stream_id);
+ h2_proxy_ihash_remove(session->streams, stream_id);
+ h2_proxy_iq_remove(session->suspended, stream_id);
if (session->done) {
session->done(session, stream->r, complete, touched);
}
void h2_proxy_session_cleanup(h2_proxy_session *session,
h2_proxy_request_done *done)
{
- if (session->streams && !h2_ihash_empty(session->streams)) {
+ if (session->streams && !h2_proxy_ihash_empty(session->streams)) {
cleanup_iter_ctx ctx;
ctx.session = session;
ctx.done = done;
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03366)
"h2_proxy_session(%s): terminated, %d streams unfinished",
- session->id, (int)h2_ihash_count(session->streams));
- h2_ihash_iter(session->streams, done_iter, &ctx);
- h2_ihash_clear(session->streams);
+ session->id, (int)h2_proxy_ihash_count(session->streams));
+ h2_proxy_ihash_iter(session->streams, done_iter, &ctx);
+ h2_proxy_ihash_clear(session->streams);
}
}
void h2_proxy_session_update_window(h2_proxy_session *session,
conn_rec *c, apr_off_t bytes)
{
- if (session->streams && !h2_ihash_empty(session->streams)) {
+ if (session->streams && !h2_proxy_ihash_empty(session->streams)) {
win_update_ctx ctx;
ctx.session = session;
ctx.c = c;
ctx.bytes = bytes;
ctx.updated = 0;
- h2_ihash_iter(session->streams, win_update_iter, &ctx);
+ h2_proxy_ihash_iter(session->streams, win_update_iter, &ctx);
if (!ctx.updated) {
/* could not find the stream any more, possibly closed, update
#include <nghttp2/nghttp2.h>
-struct h2_iqueue;
-struct h2_ihash_t;
+struct h2_proxy_iqueue;
+struct h2_proxy_ihash_t;
typedef enum {
H2_PROXYS_ST_INIT, /* send initial SETTINGS, etc. */
h2_proxys_state state;
apr_interval_time_t wait_timeout;
- struct h2_ihash_t *streams;
- struct h2_iqueue *suspended;
+ struct h2_proxy_ihash_t *streams;
+ struct h2_proxy_iqueue *suspended;
apr_size_t remote_max_concurrent;
int last_stream_id; /* last stream id processed by backend, or 0 */
#include "h2_proxy_util.h"
/* h2_log2(n) iff n is a power of 2 */
-unsigned char h2_log2(int n)
+unsigned char h2_proxy_log2(int n)
{
int lz = 0;
if (!n) {
/*******************************************************************************
* ihash - hash for structs with int identifier
******************************************************************************/
-struct h2_ihash_t {
+struct h2_proxy_ihash_t {
apr_hash_t *hash;
size_t ioff;
};
return (unsigned int)(*((int*)key));
}
-h2_ihash_t *h2_ihash_create(apr_pool_t *pool, size_t offset_of_int)
+h2_proxy_ihash_t *h2_proxy_ihash_create(apr_pool_t *pool, size_t offset_of_int)
{
- h2_ihash_t *ih = apr_pcalloc(pool, sizeof(h2_ihash_t));
+ h2_proxy_ihash_t *ih = apr_pcalloc(pool, sizeof(h2_proxy_ihash_t));
ih->hash = apr_hash_make_custom(pool, ihash);
ih->ioff = offset_of_int;
return ih;
}
-size_t h2_ihash_count(h2_ihash_t *ih)
+size_t h2_proxy_ihash_count(h2_proxy_ihash_t *ih)
{
return apr_hash_count(ih->hash);
}
-int h2_ihash_empty(h2_ihash_t *ih)
+int h2_proxy_ihash_empty(h2_proxy_ihash_t *ih)
{
return apr_hash_count(ih->hash) == 0;
}
-void *h2_ihash_get(h2_ihash_t *ih, int id)
+void *h2_proxy_ihash_get(h2_proxy_ihash_t *ih, int id)
{
return apr_hash_get(ih->hash, &id, sizeof(id));
}
typedef struct {
- h2_ihash_iter_t *iter;
+ h2_proxy_ihash_iter_t *iter;
void *ctx;
} iter_ctx;
return ictx->iter(ictx->ctx, (void*)val); /* why is this passed const?*/
}
-int h2_ihash_iter(h2_ihash_t *ih, h2_ihash_iter_t *fn, void *ctx)
+int h2_proxy_ihash_iter(h2_proxy_ihash_t *ih, h2_proxy_ihash_iter_t *fn, void *ctx)
{
iter_ctx ictx;
ictx.iter = fn;
return apr_hash_do(ihash_iter, &ictx, ih->hash);
}
-void h2_ihash_add(h2_ihash_t *ih, void *val)
+void h2_proxy_ihash_add(h2_proxy_ihash_t *ih, void *val)
{
apr_hash_set(ih->hash, ((char *)val + ih->ioff), sizeof(int), val);
}
-void h2_ihash_remove(h2_ihash_t *ih, int id)
+void h2_proxy_ihash_remove(h2_proxy_ihash_t *ih, int id)
{
apr_hash_set(ih->hash, &id, sizeof(id), NULL);
}
-void h2_ihash_remove_val(h2_ihash_t *ih, void *val)
+void h2_proxy_ihash_remove_val(h2_proxy_ihash_t *ih, void *val)
{
int id = *((int*)((char *)val + ih->ioff));
apr_hash_set(ih->hash, &id, sizeof(id), NULL);
}
-void h2_ihash_clear(h2_ihash_t *ih)
+void h2_proxy_ihash_clear(h2_proxy_ihash_t *ih)
{
apr_hash_clear(ih->hash);
}
typedef struct {
- h2_ihash_t *ih;
+ h2_proxy_ihash_t *ih;
void **buffer;
size_t max;
size_t len;
return 0;
}
-size_t h2_ihash_shift(h2_ihash_t *ih, void **buffer, size_t max)
+size_t h2_proxy_ihash_shift(h2_proxy_ihash_t *ih, void **buffer, size_t max)
{
collect_ctx ctx;
size_t i;
ctx.buffer = buffer;
ctx.max = max;
ctx.len = 0;
- h2_ihash_iter(ih, collect_iter, &ctx);
+ h2_proxy_ihash_iter(ih, collect_iter, &ctx);
for (i = 0; i < ctx.len; ++i) {
- h2_ihash_remove_val(ih, buffer[i]);
+ h2_proxy_ihash_remove_val(ih, buffer[i]);
}
return ctx.len;
}
typedef struct {
- h2_ihash_t *ih;
+ h2_proxy_ihash_t *ih;
int *buffer;
size_t max;
size_t len;
return 0;
}
-size_t h2_ihash_ishift(h2_ihash_t *ih, int *buffer, size_t max)
+size_t h2_proxy_ihash_ishift(h2_proxy_ihash_t *ih, int *buffer, size_t max)
{
icollect_ctx ctx;
size_t i;
ctx.buffer = buffer;
ctx.max = max;
ctx.len = 0;
- h2_ihash_iter(ih, icollect_iter, &ctx);
+ h2_proxy_ihash_iter(ih, icollect_iter, &ctx);
for (i = 0; i < ctx.len; ++i) {
- h2_ihash_remove(ih, buffer[i]);
+ h2_proxy_ihash_remove(ih, buffer[i]);
}
return ctx.len;
}
* iqueue - sorted list of int
******************************************************************************/
-static void iq_grow(h2_iqueue *q, int nlen);
-static void iq_swap(h2_iqueue *q, int i, int j);
-static int iq_bubble_up(h2_iqueue *q, int i, int top,
- h2_iq_cmp *cmp, void *ctx);
-static int iq_bubble_down(h2_iqueue *q, int i, int bottom,
- h2_iq_cmp *cmp, void *ctx);
+static void iq_grow(h2_proxy_iqueue *q, int nlen);
+static void iq_swap(h2_proxy_iqueue *q, int i, int j);
+static int iq_bubble_up(h2_proxy_iqueue *q, int i, int top,
+ h2_proxy_iq_cmp *cmp, void *ctx);
+static int iq_bubble_down(h2_proxy_iqueue *q, int i, int bottom,
+ h2_proxy_iq_cmp *cmp, void *ctx);
-h2_iqueue *h2_iq_create(apr_pool_t *pool, int capacity)
+h2_proxy_iqueue *h2_proxy_iq_create(apr_pool_t *pool, int capacity)
{
- h2_iqueue *q = apr_pcalloc(pool, sizeof(h2_iqueue));
+ h2_proxy_iqueue *q = apr_pcalloc(pool, sizeof(h2_proxy_iqueue));
if (q) {
q->pool = pool;
iq_grow(q, capacity);
return q;
}
-int h2_iq_empty(h2_iqueue *q)
+int h2_proxy_iq_empty(h2_proxy_iqueue *q)
{
return q->nelts == 0;
}
-int h2_iq_count(h2_iqueue *q)
+int h2_proxy_iq_count(h2_proxy_iqueue *q)
{
return q->nelts;
}
-void h2_iq_add(h2_iqueue *q, int sid, h2_iq_cmp *cmp, void *ctx)
+void h2_proxy_iq_add(h2_proxy_iqueue *q, int sid, h2_proxy_iq_cmp *cmp, void *ctx)
{
int i;
}
}
-int h2_iq_remove(h2_iqueue *q, int sid)
+int h2_proxy_iq_remove(h2_proxy_iqueue *q, int sid)
{
int i;
for (i = 0; i < q->nelts; ++i) {
return 0;
}
-void h2_iq_clear(h2_iqueue *q)
+void h2_proxy_iq_clear(h2_proxy_iqueue *q)
{
q->nelts = 0;
}
-void h2_iq_sort(h2_iqueue *q, h2_iq_cmp *cmp, void *ctx)
+void h2_proxy_iq_sort(h2_proxy_iqueue *q, h2_proxy_iq_cmp *cmp, void *ctx)
{
/* Assume that changes in ordering are minimal. This needs,
* best case, q->nelts - 1 comparisons to check that nothing
}
-int h2_iq_shift(h2_iqueue *q)
+int h2_proxy_iq_shift(h2_proxy_iqueue *q)
{
int sid;
return sid;
}
-static void iq_grow(h2_iqueue *q, int nlen)
+static void iq_grow(h2_proxy_iqueue *q, int nlen)
{
if (nlen > q->nalloc) {
int *nq = apr_pcalloc(q->pool, sizeof(int) * nlen);
}
}
-static void iq_swap(h2_iqueue *q, int i, int j)
+static void iq_swap(h2_proxy_iqueue *q, int i, int j)
{
int x = q->elts[i];
q->elts[i] = q->elts[j];
q->elts[j] = x;
}
-static int iq_bubble_up(h2_iqueue *q, int i, int top,
- h2_iq_cmp *cmp, void *ctx)
+static int iq_bubble_up(h2_proxy_iqueue *q, int i, int top,
+ h2_proxy_iq_cmp *cmp, void *ctx)
{
int prev;
while (((prev = (q->nalloc + i - 1) % q->nalloc), i != top)
return i;
}
-static int iq_bubble_down(h2_iqueue *q, int i, int bottom,
- h2_iq_cmp *cmp, void *ctx)
+static int iq_bubble_down(h2_proxy_iqueue *q, int i, int bottom,
+ h2_proxy_iq_cmp *cmp, void *ctx)
{
int next;
while (((next = (q->nalloc + i + 1) % q->nalloc), i != bottom)
}
/*******************************************************************************
- * h2_ngheader
+ * h2_proxy_ngheader
******************************************************************************/
#define H2_HD_MATCH_LIT_CS(l, name) \
((strlen(name) == sizeof(l) - 1) && !apr_strnatcasecmp(l, name))
#define NV_ADD_LIT_CS(nv, k, v) add_header(nv, k, sizeof(k) - 1, v, strlen(v))
#define NV_ADD_CS_CS(nv, k, v) add_header(nv, k, strlen(k), v, strlen(v))
-static int add_header(h2_ngheader *ngh,
+static int add_header(h2_proxy_ngheader *ngh,
const char *key, size_t key_len,
const char *value, size_t val_len)
{
return 1;
}
-h2_ngheader *h2_util_ngheader_make_req(apr_pool_t *p,
- const struct h2_request *req)
+h2_proxy_ngheader *h2_util_ngheader_make_req(apr_pool_t *p,
+ const struct h2_proxy_request *req)
{
- h2_ngheader *ngh;
+ h2_proxy_ngheader *ngh;
size_t n;
AP_DEBUG_ASSERT(req);
n = 4;
apr_table_do(count_header, &n, req->headers, NULL);
- ngh = apr_pcalloc(p, sizeof(h2_ngheader));
+ ngh = apr_pcalloc(p, sizeof(h2_proxy_ngheader));
ngh->nv = apr_pcalloc(p, n * sizeof(nghttp2_nv));
NV_ADD_LIT_CS(ngh, ":scheme", req->scheme);
NV_ADD_LIT_CS(ngh, ":authority", req->authority);
return 0;
}
-static int h2_req_ignore_header(const char *name, size_t len)
+static int h2_proxy_req_ignore_header(const char *name, size_t len)
{
return ignore_header(H2_LIT_ARGS(IgnoredRequestHeaders), name, len);
}
int h2_proxy_res_ignore_header(const char *name, size_t len)
{
- return (h2_req_ignore_header(name, len)
+ return (h2_proxy_req_ignore_header(name, len)
|| ignore_header(H2_LIT_ARGS(IgnoredProxyRespHds), name, len));
}
-void h2_util_camel_case_header(char *s, size_t len)
+void h2_proxy_util_camel_case_header(char *s, size_t len)
{
size_t start = 1;
size_t i;
{
char *hname, *hvalue;
- if (h2_req_ignore_header(name, nlen)) {
+ if (h2_proxy_req_ignore_header(name, nlen)) {
return APR_SUCCESS;
}
else if (H2_HD_MATCH_LIT("cookie", name, nlen)) {
hname = apr_pstrndup(pool, name, nlen);
hvalue = apr_pstrndup(pool, value, vlen);
- h2_util_camel_case_header(hname, nlen);
+ h2_proxy_util_camel_case_header(hname, nlen);
apr_table_mergen(headers, hname, hvalue);
return APR_SUCCESS;
}
-static h2_request *h2_req_createn(int id, apr_pool_t *pool, const char *method,
+static h2_proxy_request *h2_proxy_req_createn(int id, apr_pool_t *pool, const char *method,
const char *scheme, const char *authority,
const char *path, apr_table_t *header,
int serialize)
{
- h2_request *req = apr_pcalloc(pool, sizeof(h2_request));
+ h2_proxy_request *req = apr_pcalloc(pool, sizeof(h2_proxy_request));
req->method = method;
req->scheme = scheme;
return req;
}
-h2_request *h2_req_create(int id, apr_pool_t *pool, int serialize)
+h2_proxy_request *h2_proxy_req_create(int id, apr_pool_t *pool, int serialize)
{
- return h2_req_createn(id, pool, NULL, NULL, NULL, NULL, NULL, serialize);
+ return h2_proxy_req_createn(id, pool, NULL, NULL, NULL, NULL, NULL, serialize);
}
typedef struct {
{
h1_ctx *x = ctx;
size_t klen = strlen(key);
- if (!h2_req_ignore_header(key, klen)) {
+ if (!h2_proxy_req_ignore_header(key, klen)) {
h2_headers_add_h1(x->headers, x->pool, key, klen, value, strlen(value));
}
return 1;
}
-apr_status_t h2_req_make(h2_request *req, apr_pool_t *pool,
+apr_status_t h2_proxy_req_make(h2_proxy_request *req, apr_pool_t *pool,
const char *method, const char *scheme,
const char *authority, const char *path,
apr_table_t *headers)
* frame logging
******************************************************************************/
-int h2_util_frame_print(const nghttp2_frame *frame, char *buffer, size_t maxlen)
+int h2_proxy_util_frame_print(const nghttp2_frame *frame, char *buffer, size_t maxlen)
{
char scratch[128];
size_t s_len = sizeof(scratch)/sizeof(scratch[0]);
/*******************************************************************************
* some debugging/format helpers
******************************************************************************/
-struct h2_request;
+struct h2_proxy_request;
struct nghttp2_frame;
-int h2_util_frame_print(const nghttp2_frame *frame, char *buffer, size_t maxlen);
+int h2_proxy_util_frame_print(const nghttp2_frame *frame, char *buffer, size_t maxlen);
/*******************************************************************************
* ihash - hash for structs with int identifier
******************************************************************************/
-typedef struct h2_ihash_t h2_ihash_t;
-typedef int h2_ihash_iter_t(void *ctx, void *val);
+typedef struct h2_proxy_ihash_t h2_proxy_ihash_t;
+typedef int h2_proxy_ihash_iter_t(void *ctx, void *val);
/**
* Create a hash for structures that have an identifying int member.
* @param pool the pool to use
* @param offset_of_int the offsetof() the int member in the struct
*/
-h2_ihash_t *h2_ihash_create(apr_pool_t *pool, size_t offset_of_int);
+h2_proxy_ihash_t *h2_proxy_ihash_create(apr_pool_t *pool, size_t offset_of_int);
-size_t h2_ihash_count(h2_ihash_t *ih);
-int h2_ihash_empty(h2_ihash_t *ih);
-void *h2_ihash_get(h2_ihash_t *ih, int id);
+size_t h2_proxy_ihash_count(h2_proxy_ihash_t *ih);
+int h2_proxy_ihash_empty(h2_proxy_ihash_t *ih);
+void *h2_proxy_ihash_get(h2_proxy_ihash_t *ih, int id);
/**
* Iterate over the hash members (without defined order) and invoke
* @param ctx user supplied data passed into each iteration call
* @return 0 if one iteration returned 0, otherwise != 0
*/
-int h2_ihash_iter(h2_ihash_t *ih, h2_ihash_iter_t *fn, void *ctx);
+int h2_proxy_ihash_iter(h2_proxy_ihash_t *ih, h2_proxy_ihash_iter_t *fn, void *ctx);
-void h2_ihash_add(h2_ihash_t *ih, void *val);
-void h2_ihash_remove(h2_ihash_t *ih, int id);
-void h2_ihash_remove_val(h2_ihash_t *ih, void *val);
-void h2_ihash_clear(h2_ihash_t *ih);
+void h2_proxy_ihash_add(h2_proxy_ihash_t *ih, void *val);
+void h2_proxy_ihash_remove(h2_proxy_ihash_t *ih, int id);
+void h2_proxy_ihash_remove_val(h2_proxy_ihash_t *ih, void *val);
+void h2_proxy_ihash_clear(h2_proxy_ihash_t *ih);
-size_t h2_ihash_shift(h2_ihash_t *ih, void **buffer, size_t max);
-size_t h2_ihash_ishift(h2_ihash_t *ih, int *buffer, size_t max);
+size_t h2_proxy_ihash_shift(h2_proxy_ihash_t *ih, void **buffer, size_t max);
+size_t h2_proxy_ihash_ishift(h2_proxy_ihash_t *ih, int *buffer, size_t max);
/*******************************************************************************
* iqueue - sorted list of int with user defined ordering
******************************************************************************/
-typedef struct h2_iqueue {
+typedef struct h2_proxy_iqueue {
int *elts;
int head;
int nelts;
int nalloc;
apr_pool_t *pool;
-} h2_iqueue;
+} h2_proxy_iqueue;
/**
* Comparator for two int to determine their order.
* < 0: s1 should be sorted before s2
* > 0: s2 should be sorted before s1
*/
-typedef int h2_iq_cmp(int i1, int i2, void *ctx);
+typedef int h2_proxy_iq_cmp(int i1, int i2, void *ctx);
/**
* Allocate a new queue from the pool and initialize.
* @param id the identifier of the queue
* @param pool the memory pool
*/
-h2_iqueue *h2_iq_create(apr_pool_t *pool, int capacity);
+h2_proxy_iqueue *h2_proxy_iq_create(apr_pool_t *pool, int capacity);
/**
* Return != 0 iff there are no tasks in the queue.
* @param q the queue to check
*/
-int h2_iq_empty(h2_iqueue *q);
+int h2_proxy_iq_empty(h2_proxy_iqueue *q);
/**
* Return the number of int in the queue.
* @param q the queue to get size on
*/
-int h2_iq_count(h2_iqueue *q);
+int h2_proxy_iq_count(h2_proxy_iqueue *q);
/**
* Add a stream id to the queue.
* @param cmp the comparator for sorting
* @param ctx user data for comparator
*/
-void h2_iq_add(h2_iqueue *q, int sid, h2_iq_cmp *cmp, void *ctx);
+void h2_proxy_iq_add(h2_proxy_iqueue *q, int sid, h2_proxy_iq_cmp *cmp, void *ctx);
/**
* Remove the stream id from the queue. Return != 0 iff task
* @param sid the stream id to remove
* @return != 0 iff task was found in queue
*/
-int h2_iq_remove(h2_iqueue *q, int sid);
+int h2_proxy_iq_remove(h2_proxy_iqueue *q, int sid);
/**
* Remove all entries in the queue.
*/
-void h2_iq_clear(h2_iqueue *q);
+void h2_proxy_iq_clear(h2_proxy_iqueue *q);
/**
* Sort the stream idqueue again. Call if the task ordering
* @param cmp the comparator for sorting
* @param ctx user data for the comparator
*/
-void h2_iq_sort(h2_iqueue *q, h2_iq_cmp *cmp, void *ctx);
+void h2_proxy_iq_sort(h2_proxy_iqueue *q, h2_proxy_iq_cmp *cmp, void *ctx);
/**
* Get the first stream id from the queue or NULL if the queue is empty.
* @param q the queue to get the first task from
* @return the first stream id of the queue, 0 if empty
*/
-int h2_iq_shift(h2_iqueue *q);
+int h2_proxy_iq_shift(h2_proxy_iqueue *q);
/*******************************************************************************
* common helpers
******************************************************************************/
-/* h2_log2(n) iff n is a power of 2 */
-unsigned char h2_log2(int n);
+/* h2_proxy_log2(n) iff n is a power of 2 */
+unsigned char h2_proxy_log2(int n);
/*******************************************************************************
* HTTP/2 header helpers
******************************************************************************/
-void h2_util_camel_case_header(char *s, size_t len);
+void h2_proxy_util_camel_case_header(char *s, size_t len);
int h2_proxy_res_ignore_header(const char *name, size_t len);
/*******************************************************************************
* nghttp2 helpers
******************************************************************************/
-typedef struct h2_ngheader {
+typedef struct h2_proxy_ngheader {
nghttp2_nv *nv;
apr_size_t nvlen;
-} h2_ngheader;
-h2_ngheader *h2_util_ngheader_make_req(apr_pool_t *p,
- const struct h2_request *req);
+} h2_proxy_ngheader;
+h2_proxy_ngheader *h2_util_ngheader_make_req(apr_pool_t *p,
+ const struct h2_proxy_request *req);
/*******************************************************************************
- * h2_request helpers
+ * h2_proxy_request helpers
******************************************************************************/
-struct h2_request *h2_req_create(int id, apr_pool_t *pool, int serialize);
-apr_status_t h2_req_make(struct h2_request *req, apr_pool_t *pool,
- const char *method, const char *scheme,
- const char *authority, const char *path,
- apr_table_t *headers);
+typedef struct h2_proxy_request h2_proxy_request;
+
+struct h2_proxy_request {
+ const char *method; /* pseudo header values, see ch. 8.1.2.3 */
+ const char *scheme;
+ const char *authority;
+ const char *path;
+
+ apr_table_t *headers;
+
+ apr_time_t request_time;
+
+ unsigned int chunked : 1; /* iff requst body needs to be forwarded as chunked */
+ unsigned int serialize : 1; /* iff this request is written in HTTP/1.1 serialization */
+};
+
+h2_proxy_request *h2_proxy_req_create(int id, apr_pool_t *pool, int serialize);
+apr_status_t h2_proxy_req_make(h2_proxy_request *req, apr_pool_t *pool,
+ const char *method, const char *scheme,
+ const char *authority, const char *path,
+ apr_table_t *headers);
* @macro
* Version number of the http2 module as c string
*/
-#define MOD_HTTP2_VERSION "1.7.3-DEV"
+#define MOD_HTTP2_VERSION "1.7.4-DEV"
/**
* @macro
* 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 0x010703
+#define MOD_HTTP2_VERSION_NUM 0x010704
#endif /* mod_h2_h2_version_h */
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner,
"eng(%s): setup session", ctx->engine_id);
ctx->session = h2_proxy_session_setup(ctx->engine_id, ctx->p_conn, ctx->conf,
- 30, h2_log2(ctx->req_buffer_size),
+ 30, h2_proxy_log2(ctx->req_buffer_size),
request_done);
if (!ctx->session) {
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->owner,
status = s2;
break;
}
- if (!ctx->next && h2_ihash_empty(ctx->session->streams)) {
+ if (!ctx->next && h2_proxy_ihash_empty(ctx->session->streams)) {
break;
}
}