From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 15 May 2020 18:56:44 +0000 (+0200)
Subject: Spell out 'version' in the http_request struct
X-Git-Tag: v_3_0_29~416
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@/faq/static/eas?a=commitdiff_plain;h=c01caf9405a4f48a64173969c38be29ed8ab0ac8;p=privoxy.git

Spell out 'version' in the http_request struct
---

diff --git a/cgi.c b/cgi.c
index ec86b64b..fd72ee5e 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1605,7 +1605,7 @@ struct http_response *finish_http_response(struct client_state *csp, struct http
     * unless the client asked for HTTP/1.0.
     */
    snprintf(buf, sizeof(buf), "%s %s",
-      strcmpic(csp->http->ver, "HTTP/1.0") ? "HTTP/1.1" : "HTTP/1.0",
+      strcmpic(csp->http->version, "HTTP/1.0") ? "HTTP/1.1" : "HTTP/1.0",
       rsp->status ? rsp->status : "200 OK");
    err = enlist_first(rsp->headers, buf);
 
diff --git a/jcc.c b/jcc.c
index 61426bcb..4354fd2e 100644
--- a/jcc.c
+++ b/jcc.c
@@ -855,7 +855,7 @@ static void send_crunch_response(struct client_state *csp, struct http_response
             http->hostport, http->path);
          log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s https://%s%s %s\" %s %llu",
             csp->ip_addr_str, http->gpc, http->hostport, http->path,
-            http->ver, status_code, rsp->content_length);
+            http->version, status_code, rsp->content_length);
       }
       else
 #endif
@@ -997,10 +997,10 @@ static void build_request_line(struct client_state *csp, const struct forward_sp
     * if +downgrade action applies.
     */
    if ((csp->action->flags & ACTION_DOWNGRADE)
-     && (!strcmpic(http->ver, "HTTP/1.1")))
+     && (!strcmpic(http->version, "HTTP/1.1")))
    {
-      freez(http->ver);
-      http->ver = strdup_or_die("HTTP/1.0");
+      freez(http->version);
+      http->version = strdup_or_die("HTTP/1.0");
    }
 
    /*
@@ -1019,7 +1019,7 @@ static void build_request_line(struct client_state *csp, const struct forward_sp
       string_append(request_line, http->path);
    }
    string_append(request_line, " ");
-   string_append(request_line, http->ver);
+   string_append(request_line, http->version);
 
    if (*request_line == NULL)
    {
@@ -1910,7 +1910,7 @@ static jb_err parse_client_request(struct client_state *csp)
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
-    && (!strcmpic(csp->http->ver, "HTTP/1.1"))
+    && (!strcmpic(csp->http->version, "HTTP/1.1"))
     && (csp->http->ssl == 0))
    {
       /* Assume persistence until further notice */
@@ -3459,7 +3459,7 @@ static void handle_established_connection(struct client_state *csp)
    {
       log_error(LOG_LEVEL_CLF, "%s - - [%T] \"%s https://%s%s %s\" 200 %llu",
          csp->ip_addr_str, http->gpc, http->hostport, http->path,
-         http->ver, csp->content_length);
+         http->version, csp->content_length);
    }
    else
 #endif
diff --git a/parsers.c b/parsers.c
index 70f368f1..4517c1a0 100644
--- a/parsers.c
+++ b/parsers.c
@@ -1958,7 +1958,7 @@ static jb_err client_connection(struct client_state *csp, char **header)
       if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING)
         && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED))
       {
-          if (!strcmpic(csp->http->ver, "HTTP/1.1"))
+          if (!strcmpic(csp->http->version, "HTTP/1.1"))
           {
              log_error(LOG_LEVEL_HEADER,
                 "Removing \'%s\' to imply keep-alive.", *header);
@@ -3899,7 +3899,7 @@ static jb_err client_connection_header_adder(struct client_state *csp)
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
       && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)
-      && !strcmpic(csp->http->ver, "HTTP/1.1"))
+      && !strcmpic(csp->http->version, "HTTP/1.1"))
    {
       csp->flags |= CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE;
       return JB_ERR_OK;
@@ -4541,7 +4541,7 @@ jb_err get_destination_from_headers(const struct list *headers, struct http_requ
    string_append(&http->cmd, " ");
    string_append(&http->cmd, http->url);
    string_append(&http->cmd, " ");
-   string_append(&http->cmd, http->ver);
+   string_append(&http->cmd, http->version);
    if (http->cmd == NULL)
    {
       return JB_ERR_MEMORY;
@@ -4622,7 +4622,7 @@ jb_err get_destination_from_https_headers(const struct list *headers, struct htt
    string_append(&http->cmd, " ");
    string_append(&http->cmd, http->url);
    string_append(&http->cmd, " ");
-   string_append(&http->cmd, http->ver);
+   string_append(&http->cmd, http->version);
    if (http->cmd == NULL)
    {
       return JB_ERR_MEMORY;
diff --git a/project.h b/project.h
index e5b034bf..528ab24a 100644
--- a/project.h
+++ b/project.h
@@ -319,7 +319,7 @@ struct http_request
    char *ocmd;     /**< Backup of original cmd for CLF logging */
    char *gpc;      /**< HTTP method: GET, POST, ... */
    char *url;      /**< The URL */
-   char *ver;      /**< Protocol version */
+   char *version;  /**< Protocol version */
    int status;     /**< HTTP Status */
 
    char *host;     /**< Host part of URL */
diff --git a/urlmatch.c b/urlmatch.c
index d9532638..2bd5a8f8 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -87,7 +87,7 @@ void free_http_request(struct http_request *http)
    freez(http->url);
    freez(http->hostport);
    freez(http->path);
-   freez(http->ver);
+   freez(http->version);
    freez(http->host_ip_addr_str);
 #ifndef FEATURE_EXTENDED_HOST_PATTERNS
    freez(http->dbuffer);
@@ -587,7 +587,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->version = strdup_or_die(v[2]);
    http->ocmd = strdup_or_die(http->cmd);
 
    freez(buf);