You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2007/11/14 22:45:18 UTC

svn commit: r595077 - /httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c

Author: jerenkrantz
Date: Wed Nov 14 13:45:17 2007
New Revision: 595077

URL: http://svn.apache.org/viewvc?rev=595077&view=rev
Log:
Amsterdam sandbox: Rewrite readline per rpluem's comments to always set found;
fix up bucket vtable.

Modified:
    httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c

Modified: httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c
URL: http://svn.apache.org/viewvc/httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c?rev=595077&r1=595076&r2=595077&view=diff
==============================================================================
--- httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c (original)
+++ httpd/sandbox/amsterdam/d/modules/proxy/mod_serf.c Wed Nov 14 13:45:17 2007
@@ -447,17 +447,34 @@
                                      const char **data, apr_size_t *len)
 {
     brigade_bucket_ctx_t *ctx = bucket->data;
-    apr_status_t status;
+    apr_status_t orig_status, status;
 
-    status = apr_brigade_split_line(ctx->tmp_bb, ctx->bb,
-                                    APR_BLOCK_READ, HUGE_STRING_LEN);
-    if (APR_STATUS_IS_EAGAIN(status)) {
+    orig_status = apr_brigade_split_line(ctx->tmp_bb, ctx->bb,
+                                         APR_BLOCK_READ, HUGE_STRING_LEN);
+    if (APR_STATUS_IS_EAGAIN(orig_status)) {
         if (found) {
             *found = SERF_NEWLINE_NONE;
         }
         status = APR_SUCCESS;
     }
-    apr_brigade_pflatten(ctx->bb, data, len, ctx->pool);
+    else {
+        status = orig_status;
+    }
+
+    apr_brigade_pflatten(ctx->bb, (char**)data, len, ctx->pool);
+
+    if (orig_status == APR_SUCCESS && found) {
+        if (*len > 2 && (*data)[*len-2] == '\r' && (*data)[*len-1] == '\n') {
+            *found = SERF_NEWLINE_CRLF;
+        }
+        else if (*len && (*data)[*len-1] == '\r') {
+            *found = SERF_NEWLINE_CR;
+        } else if (*len && (*data)[*len-1] == '\n') {
+            *found = SERF_NEWLINE_LF;
+        } else {
+            *found = SERF_NEWLINE_NONE;
+        }
+    }
     return status;
 }
 
@@ -479,6 +496,7 @@
 }
 
 const serf_bucket_type_t serf_bucket_type_brigade = {
+    "BRIGADE",
     brigade_read,
     brigade_readline,
     serf_default_read_iovec,