]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge of r1763613 from trunk:
authorStefan Eissing <icing@apache.org>
Thu, 6 Oct 2016 15:39:42 +0000 (15:39 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 6 Oct 2016 15:39:42 +0000 (15:39 +0000)
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

modules/http2/h2_conn.c
modules/http2/h2_from_h1.c
modules/http2/h2_from_h1.h
modules/http2/h2_ngn_shed.c
modules/http2/h2_task.c
modules/http2/h2_task.h
modules/http2/h2_version.h

index 675ddeb26675d3a80050ae66f9c80cda9e3d6008..1d96e4c6aa1c7caf4c9fd5590e46a88923706443 100644 (file)
@@ -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);
index b7429dc7d4be0626129f9ff94a27479dbffeb43f..899512233ece8c7ce53bdf704b221f92eff2c1bb 100644 (file)
@@ -113,8 +113,8 @@ static void fix_vary(request_rec *r)
     }
 }
 
-void h2_from_h1_set_basic_http_header(apr_table_t *headers, request_rec *r,
-                                      apr_pool_t *pool)
+static void set_basic_http_header(apr_table_t *headers, request_rec *r,
+                                  apr_pool_t *pool)
 {
     char *date = NULL;
     const char *proxy_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;
index 92155396686484918d39145119b225b8e1063f0e..08101088d5566dc153d4db98583da8d0362aa9a9 100644 (file)
@@ -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__) */
index 6be6d24d712a76dac8a27d05469d87c4e977fc56..8dae7b8fa5bd46631118bc91ddbcff670b842a6e 100644 (file)
@@ -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
index 773b3768cd5250d31e0efee116ceefda380f7ca7..d6f1ff23772d18d8daabc098c01f5e61bf1a3cc1 100644 (file)
@@ -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;
 }
index 9c81a8693ace2a29b34000df6e2b03b8e01eb3a4..f607c88438002b66c14996f08d702740df71839e 100644 (file)
@@ -77,9 +77,9 @@ struct h2_task {
     
     unsigned int filters_set    : 1;
     unsigned int frozen         : 1;
-    unsigned int detached       : 1;
-    unsigned int worker_started : 1; /* h2_worker started processing for this io */
-    unsigned int worker_done    : 1; /* h2_worker finished for this io */
+    unsigned int thawed         : 1;
+    unsigned int worker_started : 1; /* h2_worker started processing */
+    unsigned int worker_done    : 1; /* h2_worker finished */
     
     apr_time_t started_at;           /* when processing started */
     apr_time_t done_at;              /* when processing was done */
@@ -116,6 +116,6 @@ extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *h2_task_logio_add_bytes_out
 
 apr_status_t h2_task_freeze(h2_task *task);
 apr_status_t h2_task_thaw(h2_task *task);
-int h2_task_is_detached(h2_task *task);
+int h2_task_has_thawed(h2_task *task);
 
 #endif /* defined(__mod_h2__h2_task__) */
index 3a1074842786e292e893d35902c134ed43ec7b83..b7c051e22e6cf060a411313dc2f417848db82eef 100644 (file)
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.7.1"
+#define MOD_HTTP2_VERSION "1.7.2"
 
 /**
  * @macro
@@ -34,7 +34,7 @@
  * 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 0x010701
+#define MOD_HTTP2_VERSION_NUM 0x010702
 
 
 #endif /* mod_h2_h2_version_h */