]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
class ClientHttpRequest had a member 'HttpVersion http_ver' which
authorwessels <>
Tue, 13 Sep 2005 04:26:39 +0000 (04:26 +0000)
committerwessels <>
Tue, 13 Sep 2005 04:26:39 +0000 (04:26 +0000)
isn't really needed.  It was only used to remember the version
between calling parseHttpRequest() (where it was initially parsed)
and clientProcessRequest() (where it is permanently saved in
HttpRequest).

This patch makes a local 'http_ver' in clientProcessRequest(),
passes its pointer to parseHttpRequest() and then its value to
clientProcessRequest().

src/client_side.cc
src/client_side_request.cc
src/client_side_request.h

index dcf72ff987c8c0f967e6cf4f8744e8befd50df04..758364030877d9ce8c6cbdd8c8b07880cfd0ca5c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.692 2005/09/12 19:24:29 wessels Exp $
+ * $Id: client_side.cc,v 1.693 2005/09/12 22:26:39 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -127,7 +127,7 @@ static PF clientLifetimeTimeout;
 static ClientSocketContext *parseHttpRequestAbort(ConnStateData::Pointer & conn,
         const char *uri);
 static ClientSocketContext *parseHttpRequest(ConnStateData::Pointer &, method_t *,
-        char **, size_t *);
+        char **, size_t *, HttpVersion *);
 #if USE_IDENT
 static IDCB clientIdentDone;
 #endif
@@ -1840,13 +1840,12 @@ prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
  */
 static ClientSocketContext *
 parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p,
-                 char **prefix_p, size_t * req_line_sz_p)
+                 char **prefix_p, size_t * req_line_sz_p, HttpVersion *http_ver)
 {
     char *inbuf = NULL;
     char *url = NULL;
     char *req_hdr = NULL;
     char *t;
-    HttpVersion http_ver;
     char *end;
     size_t header_sz;          /* size of headers, not including first line */
     size_t prefix_sz;          /* size of whole request (req-line + headers) */
@@ -1910,7 +1909,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p,
 
     /* Is there a legitimate first line to the headers ? */
     if ((result = clientParseHttpRequestLine(inbuf, conn, method_p, &url,
-                  &http_ver, http_version))) {
+                  http_ver, http_version))) {
         /* something wrong, abort */
         xfree(inbuf);
         return result;
@@ -1946,8 +1945,6 @@ parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p,
     /* Ok, all headers are received */
     http = new ClientHttpRequest;
 
-    http->http_ver = http_ver;
-
     http->setConn(conn);
 
     http->req_sz = prefix_sz;
@@ -2166,7 +2163,7 @@ clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_rea
 }
 
 static void
-clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context, method_t method, char *prefix, size_t req_line_sz)
+clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context, method_t method, char *prefix, size_t req_line_sz, HttpVersion http_ver)
 {
     ClientHttpRequest *http = context->http;
     HttpRequest *request = NULL;
@@ -2246,7 +2243,7 @@ clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context,
     request->client_port = ntohs(conn->peer.sin_port);
     request->my_addr = conn->me.sin_addr;
     request->my_port = ntohs(conn->me.sin_port);
-    request->http_ver = http->http_ver;
+    request->http_ver = http_ver;
 
     if (!urlCheckRequest(request) ||
             httpHeaderHas(&request->header, HDR_TRANSFER_ENCODING)) {
@@ -2347,6 +2344,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
     char *prefix = NULL;
     ClientSocketContext *context;
     bool parsed_req = false;
+    HttpVersion http_ver;
 
     debug(33, 5) ("clientParseRequest: FD %d: attempting to parse\n", conn->fd);
 
@@ -2365,7 +2363,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
         conn->in.buf[conn->in.notYetUsed] = '\0';
 
         /* Process request */
-        context = parseHttpRequest(conn, &method, &prefix, &req_line_sz);
+        context = parseHttpRequest(conn, &method, &prefix, &req_line_sz, &http_ver);
 
         /* partial or incomplete request */
         if (!context) {
@@ -2383,7 +2381,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
             commSetTimeout(conn->fd, Config.Timeout.lifetime, clientLifetimeTimeout,
                            context->http);
 
-            clientProcessRequest(conn, context, method, prefix, req_line_sz);
+            clientProcessRequest(conn, context, method, prefix, req_line_sz, http_ver);
 
             safe_free(prefix);
             parsed_req = true;
index 0c1f13ac5f47e04982b2fdb19cb7d911642bbb5a..60dd969b78950c52daad6911989ac4cc33959acd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.45 2005/09/09 17:31:33 wessels Exp $
+ * $Id: client_side_request.cc,v 1.46 2005/09/12 22:26:39 wessels Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -273,7 +273,6 @@ clientBeginRequest(method_t method, char const *url, CSCB * streamcallback,
     ClientHttpRequest *http = new ClientHttpRequest;
     HttpRequest *request;
     StoreIOBuffer tempBuffer;
-    http->http_ver = http_ver;
     http->setConn(NULL);
     http->start = current_time;
     /* this is only used to adjust the connection offset in client_side.c */
index fd8e244e7d93029ef0a7fd76a494600dff485b6a..1702bdd93c5665fa627845046c048814712ea407 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.h,v 1.20 2005/09/09 17:31:33 wessels Exp $
+ * $Id: client_side_request.h,v 1.21 2005/09/12 22:26:39 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -94,7 +94,6 @@ public:
     log_type logType;
 
     struct timeval start;
-    HttpVersion http_ver;
     AccessLogEntry al;
 
     struct