httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1741419 [4/4] - in /httpd/httpd/branches/2.4.x: ./ modules/http2/
Date Thu, 28 Apr 2016 12:43:02 GMT
Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_util.h?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_util.h (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_util.h Thu Apr 28 12:43:02 2016
@@ -16,6 +16,8 @@
 #ifndef __mod_h2__h2_util__
 #define __mod_h2__h2_util__
 
+#include <nghttp2/nghttp2.h>
+
 /*******************************************************************************
  * some debugging/format helpers
  ******************************************************************************/
@@ -47,7 +49,7 @@ typedef int h2_ihash_iter_t(void *ctx, v
 h2_ihash_t *h2_ihash_create(apr_pool_t *pool, size_t offset_of_int);
 
 size_t h2_ihash_count(h2_ihash_t *ih);
-int h2_ihash_is_empty(h2_ihash_t *ih);
+int h2_ihash_empty(h2_ihash_t *ih);
 void *h2_ihash_get(h2_ihash_t *ih, int id);
 
 /**
@@ -63,7 +65,120 @@ int h2_ihash_iter(h2_ihash_t *ih, h2_iha
 void h2_ihash_add(h2_ihash_t *ih, void *val);
 void h2_ihash_remove(h2_ihash_t *ih, int id);
 void h2_ihash_clear(h2_ihash_t *ih);
- 
+
+/*******************************************************************************
+ * ilist - sorted list for structs with int identifier as first member
+ ******************************************************************************/
+typedef struct h2_ilist_t h2_ilist_t;
+typedef int h2_ilist_iter_t(void *ctx, void *val);
+
+h2_ilist_t *h2_ilist_create(apr_pool_t *pool);
+
+apr_status_t h2_ilist_add(h2_ilist_t *list, void *val);
+void *h2_ilist_get(h2_ilist_t *list, int id);
+void *h2_ilist_shift(h2_ilist_t *list);
+void *h2_ilist_remove(h2_ilist_t *list, int id);
+
+int h2_ilist_empty(h2_ilist_t *list);
+apr_size_t h2_ilist_count(h2_ilist_t *list);
+
+/* Iterator over all h2_io* in the set or until a
+ * callback returns 0. It is not safe to add or remove
+ * set members during iteration.
+ *
+ * @param set the set of h2_io to iterate over
+ * @param iter the function to call for each io
+ * @param ctx user data for the callback
+ * @return 1 iff iteration completed for all members
+ */
+int h2_ilist_iter(h2_ilist_t *lis, h2_ilist_iter_t *iter, void *ctx);
+
+/*******************************************************************************
+ * iqueue - sorted list of int with user defined ordering
+ ******************************************************************************/
+typedef struct h2_iqueue {
+    int *elts;
+    int head;
+    int nelts;
+    int nalloc;
+    apr_pool_t *pool;
+} h2_iqueue;
+
+/**
+ * Comparator for two int to determine their order.
+ *
+ * @param i1 first int to compare
+ * @param i2 second int to compare
+ * @param ctx provided user data
+ * @return value is the same as for strcmp() and has the effect:
+ *    == 0: s1 and s2 are treated equal in ordering
+ *     < 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);
+
+/**
+ * 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);
+
+/**
+ * Return != 0 iff there are no tasks in the queue.
+ * @param q the queue to check
+ */
+int h2_iq_empty(h2_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);
+
+/**
+ * Add a stream idto the queue. 
+ *
+ * @param q the queue to append the task to
+ * @param sid the stream id to add
+ * @param cmp the comparator for sorting
+ * @param ctx user data for comparator 
+ */
+void h2_iq_add(h2_iqueue *q, int i, h2_iq_cmp *cmp, void *ctx);
+
+/**
+ * Remove the stream id from the queue. Return != 0 iff task
+ * was found in queue.
+ * @param q the task queue
+ * @param sid the stream id to remove
+ * @return != 0 iff task was found in queue
+ */
+int h2_iq_remove(h2_iqueue *q, int i);
+
+/**
+ * Remove all entries in the queue.
+ */
+void h2_iq_clear(h2_iqueue *q);
+
+/**
+ * Sort the stream idqueue again. Call if the task ordering
+ * has changed.
+ *
+ * @param q the queue to sort
+ * @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);
+
+/**
+ * Get the first stream id from the queue or NULL if the queue is empty. 
+ * The task will be removed.
+ *
+ * @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);
+
 /*******************************************************************************
  * common helpers
  ******************************************************************************/
@@ -164,33 +279,23 @@ h2_ngheader *h2_util_ngheader_make_req(a
 /*******************************************************************************
  * apr brigade helpers
  ******************************************************************************/
+
 /**
- * Moves data from one brigade into another. If maxlen > 0, it only
- * moves up to maxlen bytes into the target brigade, making bucket splits
- * if needed.
- * @param to the brigade to move the data to
- * @param from the brigade to get the data from
- * @param maxlen of bytes to move, <= 0 for all
- * @param pfile_buckets_allowed how many file buckets may be moved, 
- *        may be 0 or NULL
- * @param msg message for use in logging
- */
-apr_status_t h2_util_move(apr_bucket_brigade *to, apr_bucket_brigade *from, 
-                          apr_off_t maxlen, apr_size_t *pfile_buckets_allowed, 
-                          const char *msg);
-
-/**
- * Copies buckets from one brigade into another. If maxlen > 0, it only
- * copies up to maxlen bytes into the target brigade, making bucket splits
- * if needed.
- * @param to the brigade to copy the data to
- * @param from the brigade to get the data from
- * @param maxlen of bytes to copy, <= 0 for all
- * @param msg message for use in logging
+ * Concatenate at most length bytes from src to dest brigade, splitting
+ * buckets if necessary and reading buckets of indeterminate length.
  */
-apr_status_t h2_util_copy(apr_bucket_brigade *to, apr_bucket_brigade *from, 
-                          apr_off_t maxlen, const char *msg);
-
+apr_status_t h2_brigade_concat_length(apr_bucket_brigade *dest, 
+                                      apr_bucket_brigade *src,
+                                      apr_off_t length);
+                                
+/**
+ * Copy at most length bytes from src to dest brigade, splitting
+ * buckets if necessary and reading buckets of indeterminate length.
+ */
+apr_status_t h2_brigade_copy_length(apr_bucket_brigade *dest, 
+                                    apr_bucket_brigade *src,
+                                    apr_off_t length);
+                                
 /**
  * Return != 0 iff there is a FLUSH or EOS bucket in the brigade.
  * @param bb the brigade to check on
@@ -198,7 +303,6 @@ apr_status_t h2_util_copy(apr_bucket_bri
  */
 int h2_util_has_eos(apr_bucket_brigade *bb, apr_off_t len);
 int h2_util_bb_has_data(apr_bucket_brigade *bb);
-int h2_util_bb_has_data_or_eos(apr_bucket_brigade *bb);
 
 /**
  * Check how many bytes of the desired amount are available and if the
@@ -230,6 +334,21 @@ apr_status_t h2_util_bb_readx(apr_bucket
                               apr_off_t *plen, int *peos);
 
 /**
+ * Print a bucket's meta data (type and length) to the buffer.
+ * @return number of characters printed
+ */
+apr_size_t h2_util_bucket_print(char *buffer, apr_size_t bmax, 
+                                apr_bucket *b, const char *sep);
+                                
+/**
+ * Prints the brigade bucket types and lengths into the given buffer
+ * up to bmax.
+ * @return number of characters printed
+ */
+apr_size_t h2_util_bb_print(char *buffer, apr_size_t bmax, 
+                            const char *tag, const char *sep, 
+                            apr_bucket_brigade *bb);
+/**
  * Logs the bucket brigade (which bucket types with what length)
  * to the log at the given level.
  * @param c the connection to log for
@@ -243,33 +362,6 @@ void h2_util_bb_log(conn_rec *c, int str
 
 /**
  * Transfer buckets from one brigade to another with a limit on the 
- * maximum amount of bytes transfered. Sets aside the buckets to
- * pool p.
- * @param to   brigade to transfer buckets to
- * @param from brigades to remove buckets from
- * @param p    pool that buckets should be setaside to
- * @param plen maximum bytes to transfer, actual bytes transferred
- * @param peos if an EOS bucket was transferred
- */
-apr_status_t h2_ltransfer_brigade(apr_bucket_brigade *to,
-                                  apr_bucket_brigade *from, 
-                                  apr_pool_t *p,
-                                  apr_off_t *plen,
-                                  int *peos);
-
-/**
- * Transfer all buckets from one brigade to another. Sets aside the buckets to
- * pool p.
- * @param to   brigade to transfer buckets to
- * @param from brigades to remove buckets from
- * @param p    pool that buckets should be setaside to
- */
-apr_status_t h2_transfer_brigade(apr_bucket_brigade *to,
-                                 apr_bucket_brigade *from, 
-                                 apr_pool_t *p);
-
-/**
- * Transfer buckets from one brigade to another with a limit on the 
  * maximum amount of bytes transfered. Does no setaside magic, lifetime
  * of brigades must fit. 
  * @param to   brigade to transfer buckets to
@@ -291,4 +383,8 @@ apr_status_t h2_append_brigade(apr_bucke
  */
 apr_off_t h2_brigade_mem_size(apr_bucket_brigade *bb);
 
+/* when will ap_casecmpstr() be backported finally? */
+int h2_casecmpstr(const char *s1, const char *s2);
+int h2_casecmpstrn(const char *s1, const char *s2, apr_size_t n);
+
 #endif /* defined(__mod_h2__h2_util__) */

Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_version.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_version.h?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_version.h (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_version.h Thu Apr 28 12:43:02 2016
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.4.8-DEV"
+#define MOD_HTTP2_VERSION "1.5.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 0x010408
+#define MOD_HTTP2_VERSION_NUM 0x010502
 
 
 #endif /* mod_h2_h2_version_h */

Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_worker.c?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_worker.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_worker.c Thu Apr 28 12:43:02 2016
@@ -42,10 +42,8 @@ static void* APR_THREAD_FUNC execute(apr
         /* Get a h2_task from the main workers queue. */
         worker->get_next(worker, worker->ctx, &task, &sticky);
         while (task) {
-            h2_task_do(task, worker->io);
-            
-            /* if someone was waiting on this task, time to wake up */
-            apr_thread_cond_signal(worker->io);
+        
+            h2_task_do(task);
             /* report the task done and maybe get another one from the same
              * mplx (= master connection), if we can be sticky. 
              */
@@ -64,40 +62,20 @@ static void* APR_THREAD_FUNC execute(apr
 }
 
 h2_worker *h2_worker_create(int id,
-                            apr_pool_t *parent_pool,
+                            apr_pool_t *pool,
                             apr_threadattr_t *attr,
                             h2_worker_mplx_next_fn *get_next,
                             h2_worker_done_fn *worker_done,
                             void *ctx)
 {
-    apr_allocator_t *allocator = NULL;
-    apr_pool_t *pool = NULL;
-    h2_worker *w;
-    apr_status_t status;
-    
-    apr_allocator_create(&allocator);
-    apr_allocator_max_free_set(allocator, ap_max_mem_free);
-    apr_pool_create_ex(&pool, parent_pool, NULL, allocator);
-    apr_pool_tag(pool, "h2_worker");
-    apr_allocator_owner_set(allocator, pool);
-
-    w = apr_pcalloc(pool, sizeof(h2_worker));
+    h2_worker *w = apr_pcalloc(pool, sizeof(h2_worker));
     if (w) {
-        APR_RING_ELEM_INIT(w, link);
-        
         w->id = id;
-        w->pool = pool;
-
+        APR_RING_ELEM_INIT(w, link);
         w->get_next = get_next;
         w->worker_done = worker_done;
         w->ctx = ctx;
-        
-        status = apr_thread_cond_create(&w->io, w->pool);
-        if (status != APR_SUCCESS) {
-            return NULL;
-        }
-        
-        apr_thread_create(&w->thread, attr, execute, w, w->pool);
+        apr_thread_create(&w->thread, attr, execute, w, pool);
     }
     return w;
 }
@@ -109,22 +87,9 @@ apr_status_t h2_worker_destroy(h2_worker
         apr_thread_join(&status, worker->thread);
         worker->thread = NULL;
     }
-    if (worker->io) {
-        apr_thread_cond_destroy(worker->io);
-        worker->io = NULL;
-    }
-    if (worker->pool) {
-        apr_pool_destroy(worker->pool);
-        /* worker is gone */
-    }
     return APR_SUCCESS;
 }
 
-int h2_worker_get_id(h2_worker *worker)
-{
-    return worker->id;
-}
-
 void h2_worker_abort(h2_worker *worker)
 {
     worker->aborted = 1;

Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_worker.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_worker.h?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_worker.h (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_worker.h Thu Apr 28 12:43:02 2016
@@ -16,7 +16,6 @@
 #ifndef __mod_h2__h2_worker__
 #define __mod_h2__h2_worker__
 
-struct apr_thread_cond_t;
 struct h2_mplx;
 struct h2_request;
 struct h2_task;
@@ -39,19 +38,14 @@ typedef void h2_worker_done_fn(h2_worker
 
 
 struct h2_worker {
+    int id;
     /** Links to the rest of the workers */
     APR_RING_ENTRY(h2_worker) link;
-    
-    int id;
     apr_thread_t *thread;
-    apr_pool_t *pool;
-    struct apr_thread_cond_t *io;
-    
     h2_worker_mplx_next_fn *get_next;
     h2_worker_done_fn *worker_done;
     void *ctx;
-    
-    unsigned int aborted : 1;
+    int aborted;
 };
 
 /**
@@ -136,8 +130,6 @@ apr_status_t h2_worker_destroy(h2_worker
 
 void h2_worker_abort(h2_worker *worker);
 
-int h2_worker_get_id(h2_worker *worker);
-
 int h2_worker_is_aborted(h2_worker *worker);
 
 #endif /* defined(__mod_h2__h2_worker__) */

Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_workers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_workers.c?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_workers.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_workers.c Thu Apr 28 12:43:02 2016
@@ -116,7 +116,7 @@ static apr_status_t get_mplx_next(h2_wor
     if (status == APR_SUCCESS) {
         ++workers->idle_workers;
         ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, workers->s,
-                     "h2_worker(%d): looking for work", h2_worker_get_id(worker));
+                     "h2_worker(%d): looking for work", worker->id);
         
         while (!h2_worker_is_aborted(worker) && !workers->aborted
                && !(task = next_task(workers))) {
@@ -195,7 +195,7 @@ static void worker_done(h2_worker *worke
     apr_status_t status = apr_thread_mutex_lock(workers->lock);
     if (status == APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, workers->s,
-                     "h2_worker(%d): done", h2_worker_get_id(worker));
+                     "h2_worker(%d): done", worker->id);
         H2_WORKER_REMOVE(worker);
         --workers->worker_count;
         H2_WORKER_LIST_INSERT_TAIL(&workers->zombies, worker);
@@ -213,7 +213,7 @@ static apr_status_t add_worker(h2_worker
         return APR_ENOMEM;
     }
     ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, workers->s,
-                 "h2_workers: adding worker(%d)", h2_worker_get_id(w));
+                 "h2_workers: adding worker(%d)", w->id);
     ++workers->worker_count;
     H2_WORKER_LIST_INSERT_TAIL(&workers->workers, w);
     return APR_SUCCESS;

Modified: httpd/httpd/branches/2.4.x/modules/http2/mod_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/mod_http2.c?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/mod_http2.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/mod_http2.c Thu Apr 28 12:43:02 2016
@@ -57,6 +57,13 @@ AP_DECLARE_MODULE(http2) = {
 
 static int h2_h2_fixups(request_rec *r);
 
+typedef struct {
+    unsigned int change_prio : 1;
+    unsigned int sha256 : 1;
+} features;
+
+static features myfeats;
+
 /* The module initialization. Called once as apache hook, before any multi
  * processing (threaded or not) happens. It is typically at least called twice, 
  * see
@@ -77,7 +84,16 @@ static int h2_post_config(apr_pool_t *p,
     const char *mod_h2_init_key = "mod_http2_init_counter";
     nghttp2_info *ngh2;
     apr_status_t status;
+    const char *sep = "";
+    
     (void)plog;(void)ptemp;
+#ifdef H2_NG2_CHANGE_PRIO
+    myfeats.change_prio = 1;
+    sep = "+";
+#endif
+#ifdef H2_OPENSSL
+    myfeats.sha256 = 1;
+#endif
     
     apr_pool_userdata_get(&data, mod_h2_init_key, s->process->pool);
     if ( data == NULL ) {
@@ -90,8 +106,11 @@ static int h2_post_config(apr_pool_t *p,
     
     ngh2 = nghttp2_version(0);
     ap_log_error( APLOG_MARK, APLOG_INFO, 0, s, APLOGNO(03090)
-                 "mod_http2 (v%s, nghttp2 %s), initializing...",
-                 MOD_HTTP2_VERSION, ngh2? ngh2->version_str : "unknown");
+                 "mod_http2 (v%s, feats=%s%s%s, nghttp2 %s), initializing...",
+                 MOD_HTTP2_VERSION, 
+                 myfeats.change_prio? "CHPRIO" : "", sep, 
+                 myfeats.sha256?      "SHA256" : "",
+                 ngh2?                ngh2->version_str : "unknown");
     
     switch (h2_conn_mpm_type()) {
         case H2_MPM_SIMPLE:

Modified: httpd/httpd/branches/2.4.x/modules/http2/mod_http2.dsp
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/mod_http2.dsp?rev=1741419&r1=1741418&r2=1741419&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/mod_http2.dsp (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/mod_http2.dsp Thu Apr 28 12:43:02 2016
@@ -105,6 +105,10 @@ SOURCE=./h2_alt_svc.c
 # End Source File
 # Begin Source File
 
+SOURCE=./h2_bucket_beam.c
+# End Source File
+# Begin Source File
+
 SOURCE=./h2_bucket_eoc.c
 # End Source File
 # Begin Source File
@@ -141,18 +145,6 @@ SOURCE=./h2_h2.c
 # End Source File
 # Begin Source File
 
-SOURCE=./h2_int_queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=./h2_io.c
-# End Source File
-# Begin Source File
-
-SOURCE=./h2_io_set.c
-# End Source File
-# Begin Source File
-
 SOURCE=./h2_mplx.c
 # End Source File
 # Begin Source File
@@ -189,14 +181,6 @@ SOURCE=./h2_task.c
 # End Source File
 # Begin Source File
 
-SOURCE=./h2_task_input.c
-# End Source File
-# Begin Source File
-
-SOURCE=./h2_task_output.c
-# End Source File
-# Begin Source File
-
 SOURCE=./h2_util.c
 # End Source File
 # Begin Source File



Mime
View raw message