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 2015/11/03 15:33:12 UTC

svn commit: r1712300 [2/2] - /httpd/httpd/trunk/modules/http2/

Modified: httpd/httpd/trunk/modules/http2/h2_task_input.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task_input.c?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task_input.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_task_input.c Tue Nov  3 14:33:11 2015
@@ -42,28 +42,28 @@ static int ser_header(void *ctx, const c
     return 1;
 }
 
-h2_task_input *h2_task_input_create(h2_task_env *env, apr_pool_t *pool, 
+h2_task_input *h2_task_input_create(h2_task *task, apr_pool_t *pool, 
                                     apr_bucket_alloc_t *bucket_alloc)
 {
     h2_task_input *input = apr_pcalloc(pool, sizeof(h2_task_input));
     if (input) {
-        input->env = env;
+        input->task = task;
         input->bb = NULL;
         
-        if (env->serialize_headers) {
-            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, &env->c,
+        if (task->serialize_headers) {
+            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, task->c,
                           "h2_task_input(%s): serialize request %s %s", 
-                          env->id, env->method, env->path);
+                          task->id, task->method, task->path);
             input->bb = apr_brigade_create(pool, bucket_alloc);
             apr_brigade_printf(input->bb, NULL, NULL, "%s %s HTTP/1.1\r\n", 
-                               env->method, env->path);
-            apr_table_do(ser_header, input, env->headers, NULL);
+                               task->method, task->path);
+            apr_table_do(ser_header, input, task->headers, NULL);
             apr_brigade_puts(input->bb, NULL, NULL, "\r\n");
-            if (input->env->input_eos) {
+            if (input->task->input_eos) {
                 APR_BRIGADE_INSERT_TAIL(input->bb, apr_bucket_eos_create(bucket_alloc));
             }
         }
-        else if (!input->env->input_eos) {
+        else if (!input->task->input_eos) {
             input->bb = apr_brigade_create(pool, bucket_alloc);
         }
         else {
@@ -71,7 +71,7 @@ h2_task_input *h2_task_input_create(h2_t
              * create a bucket brigade. */
         }
         
-        if (APLOGcdebug(&env->c)) {
+        if (APLOGcdebug(task->c)) {
             char buffer[1024];
             apr_size_t len = sizeof(buffer)-1;
             if (input->bb) {
@@ -81,9 +81,9 @@ h2_task_input *h2_task_input_create(h2_t
                 len = 0;
             }
             buffer[len] = 0;
-            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, &env->c,
+            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, task->c,
                           "h2_task_input(%s): request is: %s", 
-                          env->id, buffer);
+                          task->id, buffer);
         }
     }
     return input;
@@ -106,12 +106,12 @@ apr_status_t h2_task_input_read(h2_task_
     
     ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, f->c,
                   "h2_task_input(%s): read, block=%d, mode=%d, readbytes=%ld", 
-                  input->env->id, block, mode, (long)readbytes);
+                  input->task->id, block, mode, (long)readbytes);
     
     if (is_aborted(f)) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
                       "h2_task_input(%s): is aborted", 
-                      input->env->id);
+                      input->task->id);
         return APR_ECONNABORTED;
     }
     
@@ -124,12 +124,12 @@ apr_status_t h2_task_input_read(h2_task_
         if (status != APR_SUCCESS) {
             ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, f->c,
                           APLOGNO(02958) "h2_task_input(%s): brigade length fail", 
-                          input->env->id);
+                          input->task->id);
             return status;
         }
     }
     
-    if ((bblen == 0) && input->env->input_eos) {
+    if ((bblen == 0) && input->task->input_eos) {
         return APR_EOF;
     }
     
@@ -139,19 +139,19 @@ apr_status_t h2_task_input_read(h2_task_
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                       "h2_task_input(%s): get more data from mplx, block=%d, "
                       "readbytes=%ld, queued=%ld",
-                      input->env->id, block, 
+                      input->task->id, block, 
                       (long)readbytes, (long)bblen);
         
         /* Although we sometimes get called with APR_NONBLOCK_READs, 
          we seem to  fill our buffer blocking. Otherwise we get EAGAIN,
          return that to our caller and everyone throws up their hands,
          never calling us again. */
-        status = h2_mplx_in_read(input->env->mplx, APR_BLOCK_READ,
-                                 input->env->stream_id, input->bb, 
-                                 input->env->io);
+        status = h2_mplx_in_read(input->task->mplx, APR_BLOCK_READ,
+                                 input->task->stream_id, input->bb, 
+                                 input->task->io);
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                       "h2_task_input(%s): mplx in read returned",
-                      input->env->id);
+                      input->task->id);
         if (status != APR_SUCCESS) {
             return status;
         }
@@ -164,13 +164,13 @@ apr_status_t h2_task_input_read(h2_task_
         }
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                       "h2_task_input(%s): mplx in read, %ld bytes in brigade",
-                      input->env->id, (long)bblen);
+                      input->task->id, (long)bblen);
     }
     
     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                   "h2_task_input(%s): read, mode=%d, block=%d, "
                   "readbytes=%ld, queued=%ld",
-                  input->env->id, mode, block, 
+                  input->task->id, mode, block, 
                   (long)readbytes, (long)bblen);
            
     if (!APR_BRIGADE_EMPTY(input->bb)) {
@@ -199,7 +199,7 @@ apr_status_t h2_task_input_read(h2_task_
                 buffer[len] = 0;
                 ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                               "h2_task_input(%s): getline: %s",
-                              input->env->id, buffer);
+                              input->task->id, buffer);
             }
             return status;
         }

Modified: httpd/httpd/trunk/modules/http2/h2_task_input.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task_input.h?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task_input.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_task_input.h Tue Nov  3 14:33:11 2015
@@ -22,16 +22,16 @@
  */
 struct apr_thread_cond_t;
 struct h2_mplx;
-struct h2_task_env;
+struct h2_task;
 
 typedef struct h2_task_input h2_task_input;
 struct h2_task_input {
-    struct h2_task_env *env;
+    struct h2_task *task;
     apr_bucket_brigade *bb;
 };
 
 
-h2_task_input *h2_task_input_create(struct h2_task_env *env, apr_pool_t *pool,
+h2_task_input *h2_task_input_create(struct h2_task *task, apr_pool_t *pool,
                                     apr_bucket_alloc_t *bucket_alloc);
 
 void h2_task_input_destroy(h2_task_input *input);

Modified: httpd/httpd/trunk/modules/http2/h2_task_output.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task_output.c?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task_output.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_task_output.c Tue Nov  3 14:33:11 2015
@@ -33,16 +33,16 @@
 #include "h2_util.h"
 
 
-h2_task_output *h2_task_output_create(h2_task_env *env, apr_pool_t *pool,
+h2_task_output *h2_task_output_create(h2_task *task, apr_pool_t *pool,
                                       apr_bucket_alloc_t *bucket_alloc)
 {
     h2_task_output *output = apr_pcalloc(pool, sizeof(h2_task_output));
     
     (void)bucket_alloc;
     if (output) {
-        output->env = env;
+        output->task = task;
         output->state = H2_TASK_OUT_INIT;
-        output->from_h1 = h2_from_h1_create(env->stream_id, pool);
+        output->from_h1 = h2_from_h1_create(task->stream_id, pool);
         if (!output->from_h1) {
             return NULL;
         }
@@ -73,18 +73,18 @@ static apr_status_t open_if_needed(h2_ta
                 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, f->c,
                               "h2_task_output(%s): write without response "
                               "for %s %s %s",
-                              output->env->id, output->env->method, 
-                              output->env->authority, output->env->path);
+                              output->task->id, output->task->method, 
+                              output->task->authority, output->task->path);
                 f->c->aborted = 1;
             }
-            if (output->env->io) {
-                apr_thread_cond_broadcast(output->env->io);
+            if (output->task->io) {
+                apr_thread_cond_broadcast(output->task->io);
             }
             return APR_ECONNABORTED;
         }
         
-        return h2_mplx_out_open(output->env->mplx, output->env->stream_id, 
-                                response, f, bb, output->env->io);
+        return h2_mplx_out_open(output->task->mplx, output->task->stream_id, 
+                                response, f, bb, output->task->io);
     }
     return APR_EOF;
 }
@@ -93,7 +93,7 @@ void h2_task_output_close(h2_task_output
 {
     open_if_needed(output, NULL, NULL);
     if (output->state != H2_TASK_OUT_DONE) {
-        h2_mplx_out_close(output->env->mplx, output->env->stream_id);
+        h2_mplx_out_close(output->task->mplx, output->task->stream_id);
         output->state = H2_TASK_OUT_DONE;
     }
 }
@@ -113,7 +113,7 @@ apr_status_t h2_task_output_write(h2_tas
     apr_status_t status;
     if (APR_BRIGADE_EMPTY(bb)) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
-                      "h2_task_output(%s): empty write", output->env->id);
+                      "h2_task_output(%s): empty write", output->task->id);
         return APR_SUCCESS;
     }
     
@@ -121,12 +121,12 @@ apr_status_t h2_task_output_write(h2_tas
     if (status != APR_EOF) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,
                       "h2_task_output(%s): opened and passed brigade", 
-                      output->env->id);
+                      output->task->id);
         return status;
     }
     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
-                  "h2_task_output(%s): write brigade", output->env->id);
-    return h2_mplx_out_write(output->env->mplx, output->env->stream_id, 
-                             f, bb, output->env->io);
+                  "h2_task_output(%s): write brigade", output->task->id);
+    return h2_mplx_out_write(output->task->mplx, output->task->stream_id, 
+                             f, bb, output->task->io);
 }
 

Modified: httpd/httpd/trunk/modules/http2/h2_task_output.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task_output.h?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task_output.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_task_output.h Tue Nov  3 14:33:11 2015
@@ -23,7 +23,7 @@
  */
 struct apr_thread_cond_t;
 struct h2_mplx;
-struct h2_task_env;
+struct h2_task;
 struct h2_from_h1;
 
 typedef enum {
@@ -35,12 +35,12 @@ typedef enum {
 typedef struct h2_task_output h2_task_output;
 
 struct h2_task_output {
-    struct h2_task_env *env;
+    struct h2_task *task;
     h2_task_output_state_t state;
     struct h2_from_h1 *from_h1;
 };
 
-h2_task_output *h2_task_output_create(struct h2_task_env *env, apr_pool_t *pool,
+h2_task_output *h2_task_output_create(struct h2_task *task, apr_pool_t *pool,
                                       apr_bucket_alloc_t *bucket_alloc);
 
 void h2_task_output_destroy(h2_task_output *output);

Modified: httpd/httpd/trunk/modules/http2/h2_to_h1.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_to_h1.c?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_to_h1.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_to_h1.c Tue Nov  3 14:33:11 2015
@@ -156,7 +156,7 @@ apr_status_t h2_to_h1_add_headers(h2_to_
     return APR_SUCCESS;
 }
 
-apr_status_t h2_to_h1_end_headers(h2_to_h1 *to_h1, h2_task *task, int eos)
+apr_status_t h2_to_h1_end_headers(h2_to_h1 *to_h1, int eos)
 {
     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, to_h1->m->c,
                   "h2_to_h1(%ld-%d): end headers", 
@@ -189,23 +189,8 @@ apr_status_t h2_to_h1_end_headers(h2_to_
         apr_table_mergen(to_h1->headers, "Transfer-Encoding", "chunked");
     }
     
-    h2_task_set_request(task, to_h1->method, 
-                        to_h1->scheme, 
-                        to_h1->authority, 
-                        to_h1->path, 
-                        to_h1->headers, eos);
     to_h1->eoh = 1;
     
-    if (eos) {
-        apr_status_t status = h2_to_h1_close(to_h1);
-        if (status != APR_SUCCESS) {
-            ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, to_h1->m->c,
-                          APLOGNO(02960) 
-                          "h2_to_h1(%ld-%d): end headers, eos=%d", 
-                          to_h1->m->id, to_h1->stream_id, eos);
-        }
-        return status;
-    }
     return APR_SUCCESS;
 }
 

Modified: httpd/httpd/trunk/modules/http2/h2_to_h1.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_to_h1.h?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_to_h1.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_to_h1.h Tue Nov  3 14:33:11 2015
@@ -68,8 +68,7 @@ apr_status_t h2_to_h1_add_headers(h2_to_
 
 /** End the request headers.
  */
-apr_status_t h2_to_h1_end_headers(h2_to_h1 *to_h1, 
-                                  struct h2_task *task, int eos);
+apr_status_t h2_to_h1_end_headers(h2_to_h1 *to_h1, int eos);
 
 /* Add request body data.
  */

Modified: httpd/httpd/trunk/modules/http2/h2_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_util.c?rev=1712300&r1=1712299&r2=1712300&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_util.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_util.c Tue Nov  3 14:33:11 2015
@@ -758,20 +758,20 @@ AP_DECLARE(apr_status_t) h2_transfer_bri
         }
         
         rv = apr_bucket_setaside(e, p);
-
+        
         /* If the bucket type does not implement setaside, then
          * (hopefully) morph it into a bucket type which does, and set
          * *that* aside... */
         if (rv == APR_ENOTIMPL) {
             const char *s;
             apr_size_t n;
-
+            
             rv = apr_bucket_read(e, &s, &n, APR_BLOCK_READ);
             if (rv == APR_SUCCESS) {
                 rv = apr_bucket_setaside(e, p);
             }
         }
-
+        
         if (rv != APR_SUCCESS) {
             /* Return an error but still save the brigade if
              * ->setaside() is really not implemented. */