You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@commons.apache.org by gs...@apache.org on 2003/11/09 11:06:03 UTC

svn commit: rev 95 - in commons/serf/branches/gen2: . buckets

Author: gstein
Date: Sun Nov  9 02:06:03 2003
New Revision: 95

Modified:
   commons/serf/branches/gen2/buckets/buckets.c
   commons/serf/branches/gen2/serf.h
   commons/serf/branches/gen2/serf_bucket_util.h
Log:
Small tweak to the readline code to tell the caller about a potential
problem with a split CRLF sequence.

* gen2/serf.h:
  (SERF_NEWLINE_CRLF_SPLIT): extra newline code to signify that a CRLF may
    be split by the end of the provided data buffer.

* gen2/serf_bucket_util.h:
  (serf_util_readline): new prototype declaration

* gen2/buckets/buckets.c:
  (find_crlf): make this static. add a missing semicolon.
  (serf_util_readline): return SERF_NEWLINE_CRLF_SPLIT when needed.


Modified: commons/serf/branches/gen2/buckets/buckets.c
==============================================================================
--- commons/serf/branches/gen2/buckets/buckets.c	(original)
+++ commons/serf/branches/gen2/buckets/buckets.c	Sun Nov  9 02:06:03 2003
@@ -415,7 +415,7 @@
 /* ==================================================================== */
 
 
-void find_crlf(const char **data, apr_size_t *len, int *found)
+static void find_crlf(const char **data, apr_size_t *len, int *found)
 {
     const char *start = *data;
     const char *end = start + *len;
@@ -434,7 +434,7 @@
             return;
         }
 
-        *len -= cr + 1 - start
+        *len -= cr + 1 - start;
         start = cr + 1;
     }
 
@@ -486,7 +486,7 @@
              * a CRLF split across the data boundary.
              * ### FIX THIS LOGIC? does caller need to detect?
              */
-            *found = SERF_NEWLINE_CR;
+            *found = want_crlf ? SERF_NEWLINE_CRLF_SPLIT : SERF_NEWLINE_CR;
         }
         else if (want_cr)
             *found = SERF_NEWLINE_CR;

Modified: commons/serf/branches/gen2/serf.h
==============================================================================
--- commons/serf/branches/gen2/serf.h	(original)
+++ commons/serf/branches/gen2/serf.h	Sun Nov  9 02:06:03 2003
@@ -327,6 +327,12 @@
 /* ### should we make this zero? */
 #define SERF_NEWLINE_NONE  0x0008
 
+/** Used to indicate that a CR was found at the end of a buffer, and CRLF
+ * was acceptable. It may be that the LF is present, but it needs to be
+ * read first.
+ */
+#define SERF_NEWLINE_CRLF_SPLIT 0x0010
+
 
 struct serf_bucket_type_t {
 

Modified: commons/serf/branches/gen2/serf_bucket_util.h
==============================================================================
--- commons/serf/branches/gen2/serf_bucket_util.h	(original)
+++ commons/serf/branches/gen2/serf_bucket_util.h	Sun Nov  9 02:06:03 2003
@@ -166,6 +166,10 @@
     void *block);
 
 
+SERF_DECLARE(void) serf_util_readline(const char **data, apr_size_t *len,
+                                      int acceptable, int *found);
+
+
 #ifdef __cplusplus
 }
 #endif