[svn:qpsmtpd] rev 422 - branches/high_perf/lib/Qpsmtpd

[email protected] 20 May 2005 12:39:06 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: msergeant
Date: Fri May 20 05:39:05 2005
New Revision: 422

Modified:
   branches/high_perf/lib/Qpsmtpd/Transaction.pm
Log:
Fix for in-memory code copying headers twice


Modified: branches/high_perf/lib/Qpsmtpd/Transaction.pm
==============================================================================
--- branches/high_perf/lib/Qpsmtpd/Transaction.pm	(original)
+++ branches/high_perf/lib/Qpsmtpd/Transaction.pm	Fri May 20 05:39:05 2005
@@ -64,6 +64,17 @@ sub notes {
 sub set_body_start {
     my $self = shift;
     $self->{_body_start} = $self->body_current_pos;
+    if ($self->{_body_file}) {
+               $self->{_header_size} = $self->{_body_start};
+    }
+    else {
+        $self->{_header_size} = 0;
+        if ($self->{_body_array}) {
+            foreach my $line (@{ $self->{_body_array} }) {
+                $self->{_header_size} += length($line);
+            }
+        }
+   }
 }
 
 sub body_start {
@@ -123,6 +134,7 @@ sub body_write {
         foreach my $line (@{ $self->{_body_array} }) {
           $self->{_body_file}->print($line) or die "Cannot print to temp file: $!";
         }
+        $self->{_body_start} = $self->{_header_size};
       }
       $self->{_body_array} = undef;
     }