Commit 6345ee36 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

Merge of r1763613 from trunk:

mod_http2: fixes compilation error on 32bit systems when generating a slave connection id


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1763614 13f79535-47bb-0310-9956-ffa450edef68
parent 15f6ebc8
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -247,7 +247,8 @@ conn_rec *h2_slave_create(conn_rec *master, apr_uint32_t slave_id,
    apr_pool_t *pool;
    conn_rec *c;
    void *cfg;
    unsigned long l;
    unsigned int free_bits;
    unsigned long l, lor;
    
    AP_DEBUG_ASSERT(master);
    ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, master,
@@ -290,12 +291,18 @@ conn_rec *h2_slave_create(conn_rec *master, apr_uint32_t slave_id,
     * many streams. 
     */
    l = master->id;
    lor = 0;
    if (sizeof(unsigned long) >= 8 && l < APR_UINT32_MAX) {
        c->id = l|((unsigned long)slave_id << 32);
        free_bits = 32;
    }
    else {
        c->id = l^(~slave_id);
        /* Assume that we never encounter ranges stream ids where this 
         * leads to many collisions. With 32 bit longs, we have a hard time
         * to make server wide unique ids. */
        free_bits = 16;
        lor= (1 << 31);
    }
    c->id = (l^((unsigned long)slave_id << free_bits))|lor;
    c->master                 = master;
    c->pool                   = pool;   
    c->conn_config            = ap_create_conn_config(pool);
+4 −4
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ static void fix_vary(request_rec *r)
    }
}

void h2_from_h1_set_basic_http_header(apr_table_t *headers, request_rec *r,
static void set_basic_http_header(apr_table_t *headers, request_rec *r,
                                  apr_pool_t *pool)
{
    char *date = NULL;
@@ -272,7 +272,7 @@ static h2_headers *create_response(h2_task *task, request_rec *r)
    
    headers = apr_table_make(r->pool, 10);
    
    h2_from_h1_set_basic_http_header(headers, r, r->pool);
    set_basic_http_header(headers, r, r->pool);
    if (r->status == HTTP_NOT_MODIFIED) {
        apr_table_do((int (*)(void *, const char *, const char *)) copy_header,
                     (void *) headers, r->headers_out,
@@ -296,7 +296,7 @@ static h2_headers *create_response(h2_task *task, request_rec *r)
    return h2_headers_rcreate(r, r->status, headers, r->pool);
}

apr_status_t h2_headers_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
apr_status_t h2_filter_headers_out(ap_filter_t *f, apr_bucket_brigade *bb)
{
    h2_task *task = f->ctx;
    request_rec *r = f->r;
+1 −4
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@
struct h2_headers;
struct h2_task;

apr_status_t h2_headers_output_filter(ap_filter_t *f, apr_bucket_brigade *bb);
apr_status_t h2_filter_headers_out(ap_filter_t *f, apr_bucket_brigade *bb);

apr_status_t h2_filter_request_in(ap_filter_t* f,
                                  apr_bucket_brigade* brigade,
@@ -43,7 +43,4 @@ apr_status_t h2_filter_request_in(ap_filter_t* f,

apr_status_t h2_filter_trailers_out(ap_filter_t *f, apr_bucket_brigade *bb);

void h2_from_h1_set_basic_http_header(apr_table_t *headers, request_rec *r,
                                      apr_pool_t *pool);

#endif /* defined(__mod_h2__h2_from_h1__) */
+2 −2
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ apr_status_t h2_ngn_shed_push_request(h2_ngn_shed *shed, const char *ngn_type,
        ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, task->c,
                      "h2_ngn_shed(%ld): pushing request %s to %s", 
                      shed->c->id, task->id, ngn->id);
        if (!h2_task_is_detached(task)) {
        if (!h2_task_has_thawed(task)) {
            h2_task_freeze(task);
        }
        ngn_add_task(ngn, task, r);
@@ -232,7 +232,7 @@ static h2_ngn_entry *pop_detached(h2_req_engine *ngn)
    for (entry = H2_REQ_ENTRIES_FIRST(&ngn->entries);
         entry != H2_REQ_ENTRIES_SENTINEL(&ngn->entries);
         entry = H2_NGN_ENTRY_NEXT(entry)) {
        if (h2_task_is_detached(entry->task) 
        if (h2_task_has_thawed(entry->task) 
            || (entry->task->engine == ngn)) {
            /* The task hosting this engine can always be pulled by it.
             * For other task, they need to become detached, e.g. no longer
+4 −4
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ void h2_task_register_hooks(void)
                             NULL, AP_FTYPE_PROTOCOL);
    ap_register_input_filter("H2_REQUEST", h2_filter_request_in,
                             NULL, AP_FTYPE_PROTOCOL);
    ap_register_output_filter("H2_RESPONSE", h2_headers_output_filter,
    ap_register_output_filter("H2_RESPONSE", h2_filter_headers_out,
                              NULL, AP_FTYPE_PROTOCOL);
    ap_register_output_filter("H2_TRAILERS_OUT", h2_filter_trailers_out,
                              NULL, AP_FTYPE_PROTOCOL);
@@ -705,11 +705,11 @@ apr_status_t h2_task_thaw(h2_task *task)
        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, task->c, APLOGNO(03407) 
                      "h2_task(%s), thawed", task->id);
    }
    task->detached = 1;
    task->thawed = 1;
    return APR_SUCCESS;
}

int h2_task_is_detached(h2_task *task)
int h2_task_has_thawed(h2_task *task)
{
    return task->detached;
    return task->thawed;
}
Loading