httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From soc-r...@apache.org
Subject svn commit: r290315 - /httpd/mod_smtpd/trunk/smtp_protocol.c
Date Mon, 19 Sep 2005 23:53:22 GMT
Author: soc-rian
Date: Mon Sep 19 16:53:19 2005
New Revision: 290315

URL: http://svn.apache.org/viewcvs?rev=290315&view=rev
Log:
Simplified spooling code

Modified:
    httpd/mod_smtpd/trunk/smtp_protocol.c

Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=290315&r1=290314&r2=290315&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Mon Sep 19 16:53:19 2005
@@ -497,9 +497,8 @@
       ap_get_module_config(scr->s->module_config,
                            &smtpd_module);
     smtpd_header_filter_ctx header_ctx = {0, scr, NULL, NULL};
-    int rv, retval = 0, saw_eos = 0;
+    int rv, retval = 0;
     char *tempfile;
-    char our_buffer[BUFFER_STR_LEN];
     const char *string, *tempdir;
     apr_file_t *tfp;
     apr_size_t len, total_data = 0;
@@ -592,20 +591,17 @@
     bb = apr_brigade_create(str->p, scr->c->bucket_alloc);
     /* wait until there is no more data
        or until we have too much data */
-    while ((total_data < pConfig->max_data) &&
-           (!saw_eos)) {
-        apr_size_t line_size;
-
+    while (total_data < pConfig->max_data) {
         ap_get_brigade(scr->transaction->input_filters, bb, AP_MODE_GETLINE,
                        APR_BLOCK_READ, 0);
         
-        for (e = APR_BRIGADE_FIRST(bb), line_size = 0;
-             e != APR_BRIGADE_SENTINEL(bb);
+        for (e = APR_BRIGADE_FIRST(bb);
+             ((e != APR_BRIGADE_SENTINEL(bb)) &&
+              (total_data < pConfig->max_data));
              e = APR_BUCKET_NEXT(e)) {
 
             if (APR_BUCKET_IS_EOS(e)) {
-                saw_eos = 1;
-                break;
+                goto done_spooling;
             }
 
             rv = apr_bucket_read(e, &string, &len, APR_BLOCK_READ);
@@ -617,14 +613,14 @@
             if (!len)
                 continue;
 
-            memcpy(our_buffer + line_size, string, len);
-            line_size += len;
+            apr_file_write(tfp, string, &len);
+
             total_data += len;
         }
-
-        apr_file_write(tfp, our_buffer, &line_size);
     }
-    
+
+ done_spooling:
+    apr_file_flush(tfp);
 
     /*
       XXX: Qpsmtpd code to add the Received Header, will get refactored



Mime
View raw message