Commit 42dcb633 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

On the trunk:

mod_http2: only when 'HttpProtocolOptions Unsafe' is configured, will
     control characters in response headers or trailers be forwarded to the
     client. Otherwise, in the default configuration, a request will eiher 
     fail with status 500 or the stream will be reset by a RST_STREAM frame. 



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1791377 13f79535-47bb-0310-9956-ffa450edef68
parent df45233c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.5.0

  *) mod_http2: only when 'HttpProtocolOptions Unsafe' is configured, will
     control characters in response headers or trailers be forwarded to the
     client. Otherwise, in the default configuration, a request will eiher 
     fail with status 500 or the stream will be reset by a RST_STREAM frame. 
     [Stefan Eissing]
     
  *) core: Disallow multiple Listen on the same IP:port when listener buckets
     are configured (ListenCoresBucketsRatio > 0), consistently with the single
     bucket case (default), thus avoiding the leak of the corresponding socket
+2 −0
Original line number Diff line number Diff line
@@ -154,5 +154,7 @@ typedef int h2_stream_pri_cmp(int stream_id1, int stream_id2, void *ctx);

#define H2_TASK_ID_NOTE         "http2-task-id"
#define H2_FILTER_DEBUG_NOTE    "http2-debug"
#define H2_HDR_CONFORMANCE      "http2-hdr-conformance"
#define H2_HDR_CONFORMANCE_UNSAFE      "unsafe"

#endif /* defined(__mod_h2__h2__) */
+16 −0
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@
#include "h2_headers.h"


static int is_unsafe(server_rec *s) 
{
    core_server_config *conf = ap_get_core_module_config(s->module_config);
    return (conf->http_conformance == AP_HTTP_CONFORMANCE_UNSAFE);
}

typedef struct {
    apr_bucket_refcount refcount;
    h2_headers *headers;
@@ -132,9 +138,19 @@ h2_headers *h2_headers_rcreate(request_rec *r, int status,
            headers->status = H2_ERR_HTTP_1_1_REQUIRED;
        }
    }
    if (is_unsafe(r->server)) {
        apr_table_setn(headers->notes, H2_HDR_CONFORMANCE, 
                       H2_HDR_CONFORMANCE_UNSAFE);
    }
    return headers;
}

h2_headers *h2_headers_copy(apr_pool_t *pool, h2_headers *h)
{
    return h2_headers_create(h->status, apr_table_copy(pool, h->headers), 
                             apr_table_copy(pool, h->notes), pool);
}

h2_headers *h2_headers_die(apr_status_t type,
                             const h2_request *req, apr_pool_t *pool)
{
+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@ h2_headers *h2_headers_create(int status, apr_table_t *header,
h2_headers *h2_headers_rcreate(request_rec *r, int status, 
                                 apr_table_t *header, apr_pool_t *pool);

/**
 * Clone the headers into another pool. This will not copy any
 * header strings.
 */
h2_headers *h2_headers_copy(apr_pool_t *pool, h2_headers *h);

/**
 * Create the headers for the given error.
 * @param stream_id id of the stream to create the headers for
+7 −7
Original line number Diff line number Diff line
@@ -39,16 +39,15 @@
typedef struct {
    apr_table_t *headers;
    apr_pool_t *pool;
    apr_status_t status;
} h1_ctx;

static int set_h1_header(void *ctx, const char *key, const char *value)
{
    h1_ctx *x = ctx;
    size_t klen = strlen(key);
    if (!h2_req_ignore_header(key, klen)) {
        h2_headers_add_h1(x->headers, x->pool, key, klen, value, strlen(value));
    }
    return 1;
    x->status = h2_req_add_header(x->headers, x->pool, key, strlen(key), 
                                  value, strlen(value));
    return (x->status == APR_SUCCESS)? 1 : 0;
}

apr_status_t h2_request_rcreate(h2_request **preq, apr_pool_t *pool, 
@@ -90,10 +89,11 @@ apr_status_t h2_request_rcreate(h2_request **preq, apr_pool_t *pool,

    x.pool = pool;
    x.headers = req->headers;
    x.status = APR_SUCCESS;
    apr_table_do(set_h1_header, &x, r->headers_in, NULL);
    
    *preq = req;
    return APR_SUCCESS;
    return x.status;
}

apr_status_t h2_request_add_header(h2_request *req, apr_pool_t *pool, 
@@ -143,7 +143,7 @@ apr_status_t h2_request_add_header(h2_request *req, apr_pool_t *pool,
    }
    else {
        /* non-pseudo header, append to work bucket of stream */
        status = h2_headers_add_h1(req->headers, pool, name, nlen, value, vlen);
        status = h2_req_add_header(req->headers, pool, name, nlen, value, vlen);
    }
    
    return status;
Loading