httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1741310 - in /httpd/httpd/trunk: modules/http2/ server/ server/mpm/event/ server/mpm/motorz/ server/mpm/simple/ server/mpm/winnt/ server/mpm/worker/
Date Wed, 27 Apr 2016 18:41:50 GMT
Author: wrowe
Date: Wed Apr 27 18:41:49 2016
New Revision: 1741310

URL: http://svn.apache.org/viewvc?rev=1741310&view=rev
Log:

  Ensure http2 follows http in the meaning of
  status WRITE (meaning 'in the request processing
  phase' even if still consuming the request body,
  not literally in a 'now writing' state).

  Ensure a number of MPMs and the h2 connection io
  no longer clobber the request status line during
  state-only changes.  While at it, clean up some
  very ugly formatting and unnecessary decoration,
  and avoid the wordy _from_conn() flavor when we
  are not passing a connection_rec.

  Ensure the useragent_ip is only used in the case
  where it has been initialized, fall back on the
  connection's remote_ip if the status is accidently
  updated from an uninitialized request_rec.


Modified:
    httpd/httpd/trunk/modules/http2/h2_conn_io.c
    httpd/httpd/trunk/modules/http2/h2_task.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/motorz/motorz.c
    httpd/httpd/trunk/server/mpm/simple/simple_io.c
    httpd/httpd/trunk/server/mpm/winnt/child.c
    httpd/httpd/trunk/server/mpm/worker/worker.c
    httpd/httpd/trunk/server/scoreboard.c

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=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn_io.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn_io.c Wed Apr 27 18:41:49 2016
@@ -191,7 +191,7 @@ static apr_status_t pass_out(apr_bucket_
         return APR_SUCCESS;
     }
     
-    ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_WRITE, c);
+    ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, NULL);
     apr_brigade_length(bb, 0, &bblen);
     h2_conn_io_bb_log(c, 0, APLOG_TRACE2, "master conn pass", bb);
     status = ap_pass_brigade(c->output_filters, bb);

Modified: httpd/httpd/trunk/modules/http2/h2_task.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_task.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_task.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_task.c Wed Apr 27 18:41:49 2016
@@ -651,7 +651,7 @@ static apr_status_t h2_task_process_requ
                   "h2_task(%s): create request_rec", task->id);
     r = h2_request_create_rec(req, c);
     if (r && (r->status == HTTP_OK)) {
-        ap_update_child_status(c->sbh, SERVER_BUSY_READ, r);
+        ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, r);
         
         if (cs) {
             cs->state = CONN_STATE_HANDLER;

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Apr 27 18:41:49 2016
@@ -5166,7 +5166,7 @@ static conn_rec *core_create_conn(apr_po
     core_server_config *sconf = ap_get_core_module_config(s->module_config);
 
     c->sbh = sbh;
-    (void)ap_update_child_status(c->sbh, SERVER_BUSY_READ, (request_rec *)NULL);
+    ap_update_child_status(c->sbh, SERVER_BUSY_READ, NULL);
 
     /* Got a connection structure, so initialize what fields we can
      * (the rest are zeroed out by pcalloc).

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Wed Apr 27 18:41:49 2016
@@ -1158,7 +1158,7 @@ read_request:
     if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
         int not_complete_yet;
 
-        ap_update_child_status_from_conn(sbh, SERVER_BUSY_WRITE, c);
+        ap_update_child_status(sbh, SERVER_BUSY_WRITE, NULL);
 
         not_complete_yet = ap_run_output_pending(c);
 
@@ -1199,7 +1199,7 @@ read_request:
         start_lingering_close_blocking(cs);
     }
     else if (cs->pub.state == CONN_STATE_CHECK_REQUEST_LINE_READABLE) {
-        ap_update_child_status_from_conn(sbh, SERVER_BUSY_KEEPALIVE, c);
+        ap_update_child_status(sbh, SERVER_BUSY_KEEPALIVE, NULL);
 
         /* It greatly simplifies the logic to use a single timeout value per q
          * because the new element can just be added to the end of the list and
@@ -2224,7 +2224,8 @@ static void *APR_THREAD_FUNC worker_thre
         }
 
         ap_update_child_status_from_indexes(process_slot, thread_slot,
-                                            dying ? SERVER_GRACEFUL : SERVER_READY, NULL);
+                                            dying ? SERVER_GRACEFUL
+                                                  : SERVER_READY, NULL);
       worker_pop:
         if (workers_may_exit) {
             break;
@@ -2280,9 +2281,8 @@ static void *APR_THREAD_FUNC worker_thre
     }
 
     ap_update_child_status_from_indexes(process_slot, thread_slot,
-                                        dying ? SERVER_DEAD :
-                                        SERVER_GRACEFUL,
-                                        (request_rec *) NULL);
+                                        dying ? SERVER_DEAD
+                                              : SERVER_GRACEFUL, NULL);
 
     apr_thread_exit(thd, APR_SUCCESS);
     return NULL;
@@ -3044,8 +3044,7 @@ static void server_main_loop(int remaini
 
                 for (i = 0; i < threads_per_child; i++)
                     ap_update_child_status_from_indexes(child_slot, i,
-                                                        SERVER_DEAD,
-                                                        (request_rec *) NULL);
+                                                        SERVER_DEAD, NULL);
 
                 event_note_child_killed(child_slot, 0, 0);
                 ps = &ap_scoreboard_image->parent[child_slot];

Modified: httpd/httpd/trunk/server/mpm/motorz/motorz.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/motorz/motorz.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/motorz/motorz.c (original)
+++ httpd/httpd/trunk/server/mpm/motorz/motorz.c Wed Apr 27 18:41:49 2016
@@ -400,7 +400,7 @@ read_request:
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(03331)
                                   "motorz_io_process(): CONN_STATE_WRITE_COMPLETION");
 
-            ap_update_child_status_from_conn(scon->sbh, SERVER_BUSY_WRITE, c);
+            ap_update_child_status(scon->sbh, SERVER_BUSY_WRITE, NULL);
 
             not_complete_yet = ap_run_output_pending(c);
 
@@ -928,7 +928,7 @@ static void child_main(motorz_core_t *mz
 
     ap_create_sb_handle(&sbh, pchild, my_child_num, 0);
 
-    (void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
+    ap_update_child_status(sbh, SERVER_READY, NULL);
 
     apr_skiplist_init(&mz->timeout_ring, mz->pool);
     apr_skiplist_set_compare(mz->timeout_ring, timer_comp, timer_comp);
@@ -1001,7 +1001,7 @@ static void child_main(motorz_core_t *mz
             clean_child_exit(0);
         }
 
-        (void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
+        ap_update_child_status(sbh, SERVER_READY, NULL);
         {
             apr_time_t tnow = apr_time_now();
             motorz_timer_t *te;
@@ -1086,8 +1086,7 @@ static int make_child(motorz_core_t *mz,
         return -1;
     }
 
-    (void) ap_update_child_status_from_indexes(slot, 0, SERVER_STARTING,
-                                               (request_rec *) NULL);
+    ap_update_child_status_from_indexes(slot, 0, SERVER_STARTING, NULL);
 
     if ((pid = fork()) == -1) {
         ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, APLOGNO(02872) "fork: Unable to fork
new process");
@@ -1095,8 +1094,7 @@ static int make_child(motorz_core_t *mz,
         /* fork didn't succeed. Fix the scoreboard or else
          * it will say SERVER_STARTING forever and ever
          */
-        (void) ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD,
-                                                   (request_rec *) NULL);
+        ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD, NULL);
 
         /* In case system resources are maxxed out, we don't want
          * Apache running away with the CPU trying to fork over and
@@ -1316,8 +1314,8 @@ static int motorz_run(apr_pool_t *_pconf
 
             /* non-fatal death... note that it's gone in the scoreboard. */
             if (child_slot >= 0) {
-                (void) ap_update_child_status_from_indexes(child_slot, 0, SERVER_DEAD,
-                                                           (request_rec *) NULL);
+                ap_update_child_status_from_indexes(child_slot, 0,
+                                                    SERVER_DEAD, NULL);
                 motorz_note_child_killed(child_slot, 0, 0);
                 if (remaining_children_to_start
                     && child_slot < ap_num_kids) {

Modified: httpd/httpd/trunk/server/mpm/simple/simple_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_io.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_io.c (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_io.c Wed Apr 27 18:41:49 2016
@@ -95,7 +95,7 @@ static apr_status_t simple_io_process(si
         if (scon->cs.state == CONN_STATE_WRITE_COMPLETION) {
             int not_complete_yet;
 
-            ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_WRITE, c);
+            ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, NULL);
             not_complete_yet = ap_run_output_pending(c);
 
             if (not_complete_yet > OK) {

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Wed Apr 27 18:41:49 2016
@@ -894,8 +894,7 @@ static DWORD __stdcall worker_main(void
         }
     }
 
-    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
-                                        (request_rec *) NULL);
+    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD, NULL);
 
     return 0;
 }
@@ -1327,13 +1326,13 @@ void child_main(apr_pool_t *pconf, DWORD
                      threads_created);
     }
     for (i = 0; i < threads_created; i++) {
-        int *score_idx;
+        int *idx;
         TerminateThread(child_handles[i], 1);
         CloseHandle(child_handles[i]);
         /* Reset the scoreboard entry for the thread we just whacked */
-        score_idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
-        if (score_idx) {
-            ap_update_child_status_from_indexes(0, *score_idx, SERVER_DEAD, NULL);
+        idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
+        if (idx) {
+            ap_update_child_status_from_indexes(0, *idx, SERVER_DEAD, NULL);
         }
     }
     ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, APLOGNO(00364)

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Wed Apr 27 18:41:49 2016
@@ -930,7 +930,8 @@ static void * APR_THREAD_FUNC worker_thr
     ap_scoreboard_image->servers[process_slot][thread_slot].pid = ap_my_pid;
     ap_scoreboard_image->servers[process_slot][thread_slot].tid = apr_os_thread_current();
     ap_scoreboard_image->servers[process_slot][thread_slot].generation = retained->my_generation;
-    ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
+    ap_update_child_status_from_indexes(process_slot, thread_slot,
+                                        SERVER_STARTING, NULL);
 
 #ifdef HAVE_PTHREAD_KILL
     unblock_signal(WORKER_SIGNAL);
@@ -951,7 +952,8 @@ static void * APR_THREAD_FUNC worker_thr
             is_idle = 1;
         }
 
-        ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_READY, NULL);
+        ap_update_child_status_from_indexes(process_slot, thread_slot,
+                                            SERVER_READY, NULL);
 worker_pop:
         if (workers_may_exit) {
             break;
@@ -997,7 +999,8 @@ worker_pop:
     }
 
     ap_update_child_status_from_indexes(process_slot, thread_slot,
-        (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
+                                        dying ? SERVER_DEAD
+                                              : SERVER_GRACEFUL, NULL);
 
     apr_thread_exit(thd, APR_SUCCESS);
     return NULL;
@@ -1734,8 +1737,8 @@ static void server_main_loop(int remaini
                 process_score *ps;
 
                 for (i = 0; i < threads_per_child; i++)
-                    ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD,
-                                                        (request_rec *) NULL);
+                    ap_update_child_status_from_indexes(child_slot, i,
+                                                        SERVER_DEAD, NULL);
 
                 worker_note_child_killed(child_slot, 0, 0);
                 ps = &ap_scoreboard_image->parent[child_slot];

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=1741310&r1=1741309&r2=1741310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Wed Apr 27 18:41:49 2016
@@ -501,7 +501,7 @@ static int update_child_status_internal(
             copy_request(ws->request, sizeof(ws->request), r);
         }
 
-        if (r) {
+        if (r && r->useragent_ip) {
             if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
                 apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
             else



Mime
View raw message