]> granicus.if.org Git - apache/commitdiff
Some flow improvements...
authorJim Jagielski <jim@apache.org>
Tue, 29 Mar 2016 16:47:05 +0000 (16:47 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 29 Mar 2016 16:47:05 +0000 (16:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1737020 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_hcheck.c

index 68b7f575f477008b6028cce541c67037e4325a8a..c8f1a7b17c10d261c511d298205e5f58d2e39e3c 100644 (file)
@@ -687,7 +687,7 @@ static apr_status_t hc_check_http(sctx_t *ctx, apr_pool_t *ptemp, proxy_worker *
     request_rec *r;
     wctx_t *wctx;
     hc_condition_t *cond;
-    const char *method;
+    const char *method = NULL;
 
     hc = hc_get_hcworker(ctx, worker, ptemp);
     wctx = (wctx_t *)hc->context;
@@ -715,27 +715,21 @@ static apr_status_t hc_check_http(sctx_t *ctx, apr_pool_t *ptemp, proxy_worker *
             break;
 
         case HEAD:
-            if (!wctx->req) {
-                wctx->req = apr_psprintf(ctx->p,
-                                   "HEAD %s%s%s HTTP/1.0\r\nHost: %s:%d\r\n\r\n",
-                                   (wctx->path ? wctx->path : ""),
-                                   (wctx->path && *hc->s->hcuri ? "/" : "" ),
-                                   (*hc->s->hcuri ? hc->s->hcuri : ""),
-                                   hc->s->hostname, (int)hc->s->port);
-            }
             method = "HEAD";
-            break;
-
+            /* fallthru */
         case GET:
+            if (!method) { /* did we fall thru? If not, we are GET */
+                method = "GET";
+            }
             if (!wctx->req) {
                 wctx->req = apr_psprintf(ctx->p,
-                                   "GET %s%s%s HTTP/1.0\r\nHost: %s:%d\r\n\r\n",
+                                   "%s %s%s%s HTTP/1.0\r\nHost: %s:%d\r\n\r\n",
+                                   method,
                                    (wctx->path ? wctx->path : ""),
                                    (wctx->path && *hc->s->hcuri ? "/" : "" ),
                                    (*hc->s->hcuri ? hc->s->hcuri : ""),
                                    hc->s->hostname, (int)hc->s->port);
             }
-            method = "GET";
             break;
 
         default:
@@ -923,15 +917,15 @@ static apr_status_t hc_watchdog_callback(int state, void *data,
                             baton->worker = worker;
                             baton->ptemp = ptemp;
 
-                            if (ctx->hctp) {
+                            if (!ctx->hctp) {
+                                hc_check(NULL, baton);
+                            }
 #if HC_USE_THREADS
+                            else {
                                 rv = apr_thread_pool_push(ctx->hctp, hc_check, (void *)baton,
                                                           APR_THREAD_TASK_PRIORITY_NORMAL, NULL);
-#endif
-                                ;
-                            } else {
-                                hc_check(NULL, baton);
                             }
+#endif
                         }
                         workers++;
                     }