You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2018/10/10 11:22:53 UTC

svn commit: r1843424 - in /httpd/httpd/trunk/modules/http2: h2_alt_svc.c h2_bucket_beam.c h2_config.c h2_conn.c h2_conn_io.c h2_filter.c h2_from_h1.c h2_push.c h2_push.h h2_version.h h2_workers.h mod_http2.c

Author: icing
Date: Wed Oct 10 11:22:53 2018
New Revision: 1843424

URL: http://svn.apache.org/viewvc?rev=1843424&view=rev
Log:
mod_http2: bringing some signed/unsigned casting goodness, aligning with github mod-h2 again

Modified:
    httpd/httpd/trunk/modules/http2/h2_alt_svc.c
    httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
    httpd/httpd/trunk/modules/http2/h2_config.c
    httpd/httpd/trunk/modules/http2/h2_conn.c
    httpd/httpd/trunk/modules/http2/h2_conn_io.c
    httpd/httpd/trunk/modules/http2/h2_filter.c
    httpd/httpd/trunk/modules/http2/h2_from_h1.c
    httpd/httpd/trunk/modules/http2/h2_push.c
    httpd/httpd/trunk/modules/http2/h2_push.h
    httpd/httpd/trunk/modules/http2/h2_version.h
    httpd/httpd/trunk/modules/http2/h2_workers.h
    httpd/httpd/trunk/modules/http2/mod_http2.c

Modified: httpd/httpd/trunk/modules/http2/h2_alt_svc.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_alt_svc.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_alt_svc.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_alt_svc.c Wed Oct 10 11:22:53 2018
@@ -46,14 +46,14 @@ h2_alt_svc *h2_alt_svc_parse(const char
 {
     const char *sep = ap_strchr_c(s, '=');
     if (sep) {
-        const char *alpn = apr_pstrmemdup(pool, s, sep - s);
+        const char *alpn = apr_pstrmemdup(pool, s, (apr_size_t)(sep - s));
         const char *host = NULL;
         int port = 0;
         s = sep + 1;
         sep = ap_strchr_c(s, ':');  /* mandatory : */
         if (sep) {
             if (sep != s) {    /* optional host */
-                host = apr_pstrmemdup(pool, s, sep - s);
+                host = apr_pstrmemdup(pool, s, (apr_size_t)(sep - s));
             }
             s = sep + 1;
             if (*s) {          /* must be a port number */

Modified: httpd/httpd/trunk/modules/http2/h2_bucket_beam.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_bucket_beam.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_bucket_beam.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_bucket_beam.c Wed Oct 10 11:22:53 2018
@@ -198,6 +198,7 @@ static apr_bucket *h2_beam_bucket(h2_buc
 
 static void mutex_leave(void *ctx, apr_thread_mutex_t *lock)
 {
+    (void)ctx;
     apr_thread_mutex_unlock(lock);
 }
 
@@ -216,6 +217,7 @@ static apr_status_t enter_yellow(h2_buck
 
 static void leave_yellow(h2_bucket_beam *beam, h2_beam_lock *pbl)
 {
+    (void)beam;
     if (pbl->leave) {
         pbl->leave(pbl->leave_ctx, pbl->mutex);
     }
@@ -228,7 +230,7 @@ static apr_off_t bucket_mem_used(apr_buc
     }
     else {
         /* should all have determinate length */
-        return b->length;
+        return (apr_off_t)b->length;
     }
 }
 
@@ -302,7 +304,7 @@ static void r_purge_sent(h2_bucket_beam
 static apr_size_t calc_space_left(h2_bucket_beam *beam)
 {
     if (beam->max_buf_size > 0) {
-        apr_off_t len = calc_buffered(beam);
+        apr_size_t len = calc_buffered(beam);
         return (beam->max_buf_size > len? (beam->max_buf_size - len) : 0);
     }
     return APR_SIZE_MAX;
@@ -777,6 +779,8 @@ static apr_status_t append_bucket(h2_buc
     apr_status_t status;
     int can_beam = 0, check_len;
     
+    (void)block;
+    (void)pbl;
     if (beam->aborted) {
         return APR_ECONNABORTED;
     }
@@ -815,8 +819,8 @@ static apr_status_t append_bucket(h2_buc
     }
     else {
         if (b->length == ((apr_size_t)-1)) {
-            const char *data;
-            status = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
+            const char *data2;
+            status = apr_bucket_read(b, &data2, &len, APR_BLOCK_READ);
             if (status != APR_SUCCESS) {
                 return status;
             }
@@ -957,7 +961,7 @@ apr_status_t h2_beam_receive(h2_bucket_b
     /* Called from the receiver thread to take buckets from the beam */
     if (enter_yellow(beam, &bl) == APR_SUCCESS) {
         if (readbytes <= 0) {
-            readbytes = APR_SIZE_MAX;
+            readbytes = (apr_off_t)APR_SIZE_MAX;
         }
         remain = readbytes;
         
@@ -1027,7 +1031,7 @@ transfer:
                     }
                     ++beam->files_beamed;
                 }
-                ng = apr_brigade_insert_file(bb, fd, bsender->start, bsender->length, 
+                ng = apr_brigade_insert_file(bb, fd, bsender->start, (apr_off_t)bsender->length, 
                                              bb->p);
 #if APR_HAS_MMAP
                 /* disable mmap handling as this leads to segfaults when
@@ -1087,9 +1091,9 @@ transfer:
                  brecv != APR_BRIGADE_SENTINEL(bb);
                  brecv = APR_BUCKET_NEXT(brecv)) {
                 remain -= (beam->tx_mem_limits? bucket_mem_used(brecv) 
-                           : brecv->length);
+                           : (apr_off_t)brecv->length);
                 if (remain < 0) {
-                    apr_bucket_split(brecv, brecv->length+remain);
+                    apr_bucket_split(brecv, (apr_size_t)((apr_off_t)brecv->length+remain));
                     beam->recv_buffer = apr_brigade_split_ex(bb, 
                                                              APR_BUCKET_NEXT(brecv), 
                                                              beam->recv_buffer);
@@ -1255,6 +1259,7 @@ apr_size_t h2_beam_get_files_beamed(h2_b
 
 int h2_beam_no_files(void *ctx, h2_bucket_beam *beam, apr_file_t *file)
 {
+    (void)ctx; (void)beam; (void)file;
     return 0;
 }
 

Modified: httpd/httpd/trunk/modules/http2/h2_config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_config.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_config.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_config.c Wed Oct 10 11:22:53 2018
@@ -221,7 +221,7 @@ const struct h2_priority *h2_config_get_
                                                  const char *content_type)
 {
     if (content_type && conf->priorities) {
-        size_t len = strcspn(content_type, "; \t");
+        apr_ssize_t len = (apr_ssize_t)strcspn(content_type, "; \t");
         h2_priority *prio = apr_hash_get(conf->priorities, content_type, len);
         return prio? prio : apr_hash_get(conf->priorities, "*", 1);
     }
@@ -400,7 +400,8 @@ static const char *h2_conf_add_push_prio
     h2_dependency dependency;
     h2_priority *priority;
     int weight;
-    
+ 
+    (void)_cfg;
     if (!*ctype) {
         return "1st argument must be a mime-type, like 'text/css' or '*'";
     }
@@ -443,7 +444,7 @@ static const char *h2_conf_add_push_prio
     if (!cfg->priorities) {
         cfg->priorities = apr_hash_make(cmd->pool);
     }
-    apr_hash_set(cfg->priorities, ctype, strlen(ctype), priority);
+    apr_hash_set(cfg->priorities, ctype, (apr_ssize_t)strlen(ctype), priority);
     return NULL;
 }
 
@@ -521,6 +522,8 @@ static const char *h2_conf_set_copy_file
                                           void *arg, const char *value)
 {
     h2_config *cfg = (h2_config *)arg;
+    
+    (void)parms;
     if (!strcasecmp(value, "On")) {
         cfg->copy_files = 1;
         return NULL;

Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Wed Oct 10 11:22:53 2018
@@ -250,6 +250,8 @@ apr_status_t h2_conn_run(struct h2_ctx *
 apr_status_t h2_conn_pre_close(struct h2_ctx *ctx, conn_rec *c)
 {
     h2_session *session = h2_ctx_session_get(ctx);
+    
+    (void)c;
     if (session) {
         apr_status_t status = h2_session_pre_close(session, async_mpm);
         return (status == APR_SUCCESS)? DONE : status;

Modified: httpd/httpd/trunk/modules/http2/h2_conn_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn_io.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn_io.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn_io.c Wed Oct 10 11:22:53 2018
@@ -47,16 +47,18 @@
  */
 #define WRITE_SIZE_MAX        (TLS_DATA_MAX - 100) 
 
+#define BUF_REMAIN            ((apr_size_t)(bmax-off))
 
 static void h2_conn_io_bb_log(conn_rec *c, int stream_id, int level, 
                               const char *tag, apr_bucket_brigade *bb)
 {
     char buffer[16 * 1024];
     const char *line = "(null)";
-    apr_size_t bmax = sizeof(buffer)/sizeof(buffer[0]);
+    int bmax = sizeof(buffer)/sizeof(buffer[0]);
     int off = 0;
     apr_bucket *b;
     
+    (void)stream_id;
     if (bb) {
         memset(buffer, 0, bmax--);
         for (b = APR_BRIGADE_FIRST(bb); 
@@ -65,19 +67,19 @@ static void h2_conn_io_bb_log(conn_rec *
             
             if (APR_BUCKET_IS_METADATA(b)) {
                 if (APR_BUCKET_IS_EOS(b)) {
-                    off += apr_snprintf(buffer+off, bmax-off, "eos ");
+                    off += apr_snprintf(buffer+off, BUF_REMAIN, "eos ");
                 }
                 else if (APR_BUCKET_IS_FLUSH(b)) {
-                    off += apr_snprintf(buffer+off, bmax-off, "flush ");
+                    off += apr_snprintf(buffer+off, BUF_REMAIN, "flush ");
                 }
                 else if (AP_BUCKET_IS_EOR(b)) {
-                    off += apr_snprintf(buffer+off, bmax-off, "eor ");
+                    off += apr_snprintf(buffer+off, BUF_REMAIN, "eor ");
                 }
                 else if (H2_BUCKET_IS_H2EOS(b)) {
-                    off += apr_snprintf(buffer+off, bmax-off, "h2eos ");
+                    off += apr_snprintf(buffer+off, BUF_REMAIN, "h2eos ");
                 }
                 else {
-                    off += apr_snprintf(buffer+off, bmax-off, "meta(unknown) ");
+                    off += apr_snprintf(buffer+off, BUF_REMAIN, "meta(unknown) ");
                 }
             }
             else {
@@ -109,10 +111,9 @@ static void h2_conn_io_bb_log(conn_rec *
                     btype = "pool";
                 }
                 
-                off += apr_snprintf(buffer+off, bmax-off, "%s[%ld] ", 
+                off += apr_snprintf(buffer+off, BUF_REMAIN, "%s[%ld] ", 
                                     btype, 
-                                    (long)(b->length == ((apr_size_t)-1)? 
-                                           -1 : b->length));
+                                    (long)(b->length == ((apr_size_t)-1)? -1UL : b->length));
             }
         }
         line = *buffer? buffer : "(empty)";
@@ -153,7 +154,7 @@ apr_status_t h2_conn_io_init(h2_conn_io
                       "h2_conn_io(%ld): init, buffering=%d, warmup_size=%ld, "
                       "cd_secs=%f", io->c->id, io->buffer_output, 
                       (long)io->warmup_size,
-                      ((float)io->cooldown_usecs/APR_USEC_PER_SEC));
+                      ((double)io->cooldown_usecs/APR_USEC_PER_SEC));
     }
 
     return APR_SUCCESS;
@@ -202,8 +203,8 @@ static apr_status_t read_to_scratch(h2_c
         apr_bucket_file *f = (apr_bucket_file *)b->data;
         apr_file_t *fd = f->fd;
         apr_off_t offset = b->start;
-        apr_size_t len = b->length;
         
+        len = b->length;
         /* file buckets will either mmap (which we do not want) or
          * read 8000 byte chunks and split themself. However, we do
          * know *exactly* how many bytes we need where.
@@ -288,13 +289,13 @@ int h2_conn_io_needs_flush(h2_conn_io *i
 {
     if (!io->is_flushed) {
         apr_off_t len = h2_brigade_mem_size(io->output);
-        if (len > io->flush_threshold) {
+        if (len > (apr_off_t)io->flush_threshold) {
             return 1;
         }
         /* if we do not exceed flush length due to memory limits,
          * we want at least flush when we have that amount of data. */
         apr_brigade_length(io->output, 0, &len);
-        return len > (4 * io->flush_threshold);
+        return len > (apr_off_t)(4 * io->flush_threshold);
     }
     return 0;
 }

Modified: httpd/httpd/trunk/modules/http2/h2_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_filter.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_filter.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_filter.c Wed Oct 10 11:22:53 2018
@@ -54,6 +54,7 @@ static apr_status_t recv_RAW_DATA(conn_r
     const char *data;
     ssize_t n;
     
+    (void)c;
     status = apr_bucket_read(b, &data, &len, block);
     
     while (status == APR_SUCCESS && len > 0) {
@@ -71,10 +72,10 @@ static apr_status_t recv_RAW_DATA(conn_r
         }
         else {
             session->io.bytes_read += n;
-            if (len <= n) {
+            if ((apr_ssize_t)len <= n) {
                 break;
             }
-            len -= n;
+            len -= (apr_size_t)n;
             data += n;
         }
     }
@@ -277,6 +278,7 @@ apr_bucket *h2_bucket_observer_beam(stru
                                     apr_bucket_brigade *dest,
                                     const apr_bucket *src)
 {
+    (void)beam;
     if (H2_BUCKET_IS_OBSERVER(src)) {
         h2_bucket_observer *l = (h2_bucket_observer *)src->data; 
         apr_bucket *b = h2_bucket_observer_create(dest->bucket_alloc, 

Modified: httpd/httpd/trunk/modules/http2/h2_from_h1.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_from_h1.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_from_h1.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_from_h1.c Wed Oct 10 11:22:53 2018
@@ -625,10 +625,10 @@ static void make_chunk(h2_task *task, ap
      * to the end of the brigade. */
     char buffer[128];
     apr_bucket *c;
-    int len;
+    apr_size_t len;
     
-    len = apr_snprintf(buffer, H2_ALEN(buffer), 
-                       "%"APR_UINT64_T_HEX_FMT"\r\n", (apr_uint64_t)chunk_len);
+    len = (apr_size_t)apr_snprintf(buffer, H2_ALEN(buffer), 
+                                   "%"APR_UINT64_T_HEX_FMT"\r\n", (apr_uint64_t)chunk_len);
     c = apr_bucket_heap_create(buffer, len, NULL, bb->bucket_alloc);
     APR_BUCKET_INSERT_BEFORE(first, c);
     c = apr_bucket_heap_create("\r\n", 2, NULL, bb->bucket_alloc);

Modified: httpd/httpd/trunk/modules/http2/h2_push.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_push.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_push.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_push.c Wed Oct 10 11:22:53 2018
@@ -59,7 +59,7 @@ static const char *policy_str(h2_push_po
 
 typedef struct {
     const h2_request *req;
-    int push_policy;
+    apr_uint32_t push_policy;
     apr_pool_t *pool;
     apr_array_header_t *pushes;
     const char *s;
@@ -434,7 +434,7 @@ static int head_iter(void *ctx, const ch
 }
 
 apr_array_header_t *h2_push_collect(apr_pool_t *p, const h2_request *req,
-                                    int push_policy, const h2_headers *res)
+                                    apr_uint32_t push_policy, const h2_headers *res)
 {
     if (req && push_policy != H2_PUSH_NONE) {
         /* Collect push candidates from the request/response pair.
@@ -528,13 +528,14 @@ static void calc_sha256_hash(h2_push_dia
 
 static unsigned int val_apr_hash(const char *str) 
 {
-    apr_ssize_t len = strlen(str);
+    apr_ssize_t len = (apr_ssize_t)strlen(str);
     return apr_hashfunc_default(str, &len);
 }
 
 static void calc_apr_hash(h2_push_diary *diary, apr_uint64_t *phash, h2_push *push) 
 {
     apr_uint64_t val;
+    (void)diary;
 #if APR_UINT64_MAX > UINT_MAX
     val = ((apr_uint64_t)(val_apr_hash(push->req->scheme)) << 32);
     val ^= ((apr_uint64_t)(val_apr_hash(push->req->authority)) << 16);
@@ -621,10 +622,10 @@ static h2_push_diary_entry *move_to_last
 {
     h2_push_diary_entry *entries = (h2_push_diary_entry*)diary->entries->elts;
     h2_push_diary_entry e;
-    apr_size_t lastidx = diary->entries->nelts-1;
+    apr_size_t lastidx = (apr_size_t)diary->entries->nelts;
     
     /* move entry[idx] to the end */
-    if (idx < lastidx) {
+    if (idx+1 < lastidx) {
         e =  entries[idx];
         memmove(entries+idx, entries+idx+1, sizeof(e) * (lastidx - idx));
         entries[lastidx] = e;
@@ -670,7 +671,7 @@ apr_array_header_t *h2_push_diary_update
                 /* Intentional no APLOGNO */
                 ap_log_cerror(APLOG_MARK, GCSLOG_LEVEL, 0, session->c,
                               "push_diary_update: already there PUSH %s", push->req->path);
-                move_to_last(session->push_diary, idx);
+                move_to_last(session->push_diary, (apr_size_t)idx);
             }
             else {
                 /* Intentional no APLOGNO */
@@ -830,7 +831,7 @@ apr_status_t h2_push_diary_digest_get(h2
     
     nelts = diary->entries->nelts;
     
-    if (nelts > APR_UINT32_MAX) {
+    if ((apr_uint32_t)nelts > APR_UINT32_MAX) {
         /* should not happen */
         return APR_ENOTIMPL;
     }

Modified: httpd/httpd/trunk/modules/http2/h2_push.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_push.h?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_push.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_push.h Wed Oct 10 11:22:53 2018
@@ -61,7 +61,7 @@ struct h2_push_diary {
  */
 apr_array_header_t *h2_push_collect(apr_pool_t *p, 
                                     const struct h2_request *req, 
-                                    int push_policy, 
+                                    apr_uint32_t push_policy, 
                                     const struct h2_headers *res);
 
 /**

Modified: httpd/httpd/trunk/modules/http2/h2_version.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_version.h?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_version.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_version.h Wed Oct 10 11:22:53 2018
@@ -27,7 +27,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.11.0-DEV"
+#define MOD_HTTP2_VERSION "1.11.2-DEV"
 
 /**
  * @macro
@@ -35,7 +35,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 0x010b00
+#define MOD_HTTP2_VERSION_NUM 0x010b02
 
 
 #endif /* mod_h2_h2_version_h */

Modified: httpd/httpd/trunk/modules/http2/h2_workers.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_workers.h?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_workers.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_workers.h Wed Oct 10 11:22:53 2018
@@ -38,8 +38,8 @@ struct h2_workers {
     apr_pool_t *pool;
     
     int next_worker_id;
-    int min_workers;
-    int max_workers;
+    apr_uint32_t min_workers;
+    apr_uint32_t max_workers;
     int max_idle_secs;
     
     int aborted;

Modified: httpd/httpd/trunk/modules/http2/mod_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_http2.c?rev=1843424&r1=1843423&r2=1843424&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_http2.c Wed Oct 10 11:22:53 2018
@@ -184,7 +184,7 @@ static apr_status_t http2_req_engine_pul
                                           int capacity, 
                                           request_rec **pr)
 {
-    return h2_mplx_req_engine_pull(ngn, block, capacity, pr);
+    return h2_mplx_req_engine_pull(ngn, block, (apr_uint32_t)capacity, pr);
 }
 
 static void http2_req_engine_done(h2_req_engine *ngn, conn_rec *r_conn,