[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current jcc.c, 1.275, 1.276 parsers.c, 1.205,
From:       noreply () sourceforge ! net
Date:       2009-08-19 15:57:15
Message-ID: E1MdnXH-0000tN-Pb () 23jxhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3425

Modified Files:
	jcc.c parsers.c project.h 
Log Message:
In preparation to allow connection reuse after forwarding POST requests, save the \
value of the Content-Length header sent by the client.


Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -d -r1.275 -r1.276
--- jcc.c	22 Jul 2009 22:31:54 -0000	1.275
+++ jcc.c	19 Aug 2009 15:57:13 -0000	1.276
@@ -2398,6 +2398,7 @@
             csp->content_type = 0;
             csp->content_length = 0;
             csp->expected_content_length = 0;
+            csp->expected_client_content_length = 0;
             list_remove_all(csp->headers);
             freez(csp->iob->buf);
             memset(csp->iob, 0, sizeof(csp->iob));

Index: parsers.c
===================================================================
RCS file: /cvsroot/ijbswa/current/parsers.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- parsers.c	19 Aug 2009 15:26:36 -0000	1.205
+++ parsers.c	19 Aug 2009 15:57:13 -0000	1.206
@@ -158,6 +158,7 @@
 static jb_err server_keep_alive(struct client_state *csp, char **header);
 static jb_err server_proxy_connection(struct client_state *csp, char **header);
 static jb_err client_keep_alive(struct client_state *csp, char **header);
+static jb_err client_save_content_length(struct client_state *csp, char **header);
 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 static jb_err client_host_adder       (struct client_state *csp);
@@ -204,6 +205,7 @@
    { "if-modified-since:",       18,   client_if_modified_since },
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
    { "Keep-Alive:",              11,   client_keep_alive },
+   { "Content-Length:",          15,   client_save_content_length },
 #else
    { "Keep-Alive:",              11,   crumble },
 #endif
@@ -1750,6 +1752,52 @@
 
    return JB_ERR_OK;
 }
+
+
+/*********************************************************************
+ *
+ * Function    :  client_save_content_length
+ *
+ * Description :  Save the Content-Length sent by the client.
+ *
+ *                XXX: Shares code with the server version
+ *                     that should be factored out.
+ *
+ * Parameters  :
+ *          1  :  csp = Current client state (buffers, headers, etc...)
+ *          2  :  header = On input, pointer to header to modify.
+ *                On output, pointer to the modified header, or NULL
+ *                to remove the header.  This function frees the
+ *                original string if necessary.
+ *
+ * Returns     :  JB_ERR_OK on success, or
+ *                JB_ERR_MEMORY on out-of-memory error.
+ *
+ *********************************************************************/
+static jb_err client_save_content_length(struct client_state *csp, char **header)
+{
+   unsigned long long content_length = 0;
+
+   assert(*(*header+14) == ':');
+
+#ifdef _WIN32
+   if (1 != sscanf(*header+14, ": %I64u", &content_length))
+#else
+   if (1 != sscanf(*header+14, ": %llu", &content_length))
+#endif
+   {
+      log_error(LOG_LEVEL_ERROR, "Crunching invalid header: %s", *header);
+      freez(*header);
+   }
+   else
+   {
+      log_error(LOG_LEVEL_CONNECT,
+         "Setting client content lenght %llu", content_length);
+      csp->expected_client_content_length = content_length;
+   }
+
+   return JB_ERR_OK;
+}
 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 

Index: project.h
===================================================================
RCS file: /cvsroot/ijbswa/current/project.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- project.h	18 Jul 2009 12:20:05 -0000	1.148
+++ project.h	19 Aug 2009 15:57:13 -0000	1.149
@@ -878,11 +878,17 @@
    unsigned long long content_length;
 
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
+   /* XXX: is this the right location? */
+
    /** Expected length of content after which we
     * should stop reading from the server socket.
     */
-   /* XXX: is this the right location? */
    unsigned long long expected_content_length;
+
+   /** Expected length of content after which we
+    *  should stop reading from the client socket.
+    */
+   unsigned long long expected_client_content_length;
 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 #ifdef FEATURE_TRUST


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic