[Catalyst-commits] r9869 - in HTTP-Request-AsCGI/trunk: . lib/HTTP/Request

hdp at dev.catalyst.perl.org hdp at dev.catalyst.perl.org
Sun Apr 26 23:02:17 GMT 2009


Author: hdp
Date: 2009-04-27 00:02:17 +0100 (Mon, 27 Apr 2009)
New Revision: 9869

Modified:
   HTTP-Request-AsCGI/trunk/Changes
   HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
Log:
do not mix syswrite/seek with buffered IO (as in CGI.pm); it causes difficult-to-testably-reproduce bugs where the CGI environment doesn't see the entire STDIN content

Modified: HTTP-Request-AsCGI/trunk/Changes
===================================================================
--- HTTP-Request-AsCGI/trunk/Changes	2009-04-26 23:02:09 UTC (rev 9868)
+++ HTTP-Request-AsCGI/trunk/Changes	2009-04-26 23:02:17 UTC (rev 9869)
@@ -1,5 +1,9 @@
 This file documents the revision history for Perl extension HTTP::Request::AsCGI.
 
+0.5_02 2009-04-29
+    - Avoid mixing buffered and unbuffered IO and flush STDIN after writing
+      request content to it. (hdp)
+
 0.5  2006-01-20
     - Fixed bug where content was overridden on 500 responses.
 

Modified: HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
===================================================================
--- HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm	2009-04-26 23:02:09 UTC (rev 9868)
+++ HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm	2009-04-26 23:02:17 UTC (rev 9869)
@@ -85,11 +85,14 @@
 
     if ( $self->request->content_length ) {
 
-        syswrite( $self->stdin, $self->request->content )
+        $self->stdin->print($self->request->content)
           or croak("Can't write request content to stdin handle: $!");
 
-        sysseek( $self->stdin, 0, SEEK_SET )
+        $self->stdin->seek(0, SEEK_SET)
           or croak("Can't seek stdin handle: $!");
+
+        $self->stdin->flush
+          or croak("Can't flush stdin handle: $!");
     }
 
     open( $self->{restore}->{stdin}, '<&', STDIN->fileno )




More information about the Catalyst-commits mailing list