From ba3a814851f5097de66ea12e3bbde560ca079446 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Tue, 3 Jun 2014 10:25:57 +0000
Subject: [PATCH] Reduce code duplication by setting http->ocmd in
 parse_http_request()

---
 jcc.c      | 11 +----------
 urlmatch.c |  3 ++-
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/jcc.c b/jcc.c
index 83d1ecea..d9960f7c 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.426 2014/06/02 06:19:06 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.427 2014/06/02 06:22:21 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -924,11 +924,6 @@ static jb_err change_request_destination(struct client_state *csp)
       log_error(LOG_LEVEL_ERROR, "Couldn't parse rewritten request: %s.",
          jb_err_to_string(err));
    }
-   else
-   {
-      /* XXX: ocmd is a misleading name */
-      http->ocmd = strdup_or_die(http->cmd);
-   }
 
    return err;
 }
@@ -1607,10 +1602,6 @@ static jb_err receive_client_request(struct client_state *csp)
       get_url_actions(csp, http);
    }
 
-   /*
-    * Save a copy of the original request for logging
-    */
-   http->ocmd = strdup_or_die(http->cmd);
    enlist(csp->headers, http->cmd);
 
    /* Append the previously read headers */
diff --git a/urlmatch.c b/urlmatch.c
index 57c538ea..c1fc5cbb 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -1,4 +1,4 @@
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.80 2013/11/24 14:47:45 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.81 2014/05/26 10:48:07 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
@@ -543,6 +543,7 @@ jb_err parse_http_request(const char *req, struct http_request *http)
    http->cmd = strdup_or_die(req);
    http->gpc = strdup_or_die(v[0]);
    http->ver = strdup_or_die(v[2]);
+   http->ocmd = strdup_or_die(http->cmd);
 
    freez(buf);
 
-- 
2.49.0