Skip Menu |

This queue is for tickets about the POE-Component-Server-SimpleHTTP CPAN distribution.

Report information
The Basics
Id: 67949
Status: resolved
Priority: 0/
Queue: POE-Component-Server-SimpleHTTP

People
Owner: Nobody in particular
Requestors: adrian [...] gt.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.10
Fixed in: 2.12



Subject: Patch: Connection closes before last flush while streaming
Since the pod isn't complete for how to properly stream, I'm not 100% sure this patch is correct, but here goes anyways. After you've completed streaming and you call DONE, it always yields got_flush regardless if POE::Wheel::ReadWrite has something left in its buffer to flush. Executing the got_flush event when it has data left in its buffer leads to SimpleHTTP resetting/closing the connection prematurely. This patch fixes it by allowing ReadWrite to flush the last chunk itself. Adrian --- POE/Component/Server/SimpleHTTP.pm.orig 2011-05-03 17:53:56.000000000 -0700 +++ POE/Component/Server/SimpleHTTP.pm 2011-05-03 17:54:03.000000000 -0700 @@ -902,7 +902,9 @@ $self->_requests->{$id}->set_streaming(0); $self->_requests->{$id}->set_done(1); # Finished streaming # TODO: We might not get a flush, trigger it ourselves. - $kernel->yield( 'got_flush', $id ); + if ( !$self->_requests->{$id}->wheel->get_driver_out_messages ) { + $kernel->yield( 'got_flush', $id ); + } return; }
From: adrian [...] gt.net
Patch attached since RT mangles things.
Subject: SimpleHTTP.streaming.flush.patch
--- POE/Component/Server/SimpleHTTP.pm.orig 2011-05-03 17:53:56.000000000 -0700 +++ POE/Component/Server/SimpleHTTP.pm 2011-05-03 17:54:03.000000000 -0700 @@ -902,7 +902,9 @@ $self->_requests->{$id}->set_streaming(0); $self->_requests->{$id}->set_done(1); # Finished streaming # TODO: We might not get a flush, trigger it ourselves. - $kernel->yield( 'got_flush', $id ); + if ( !$self->_requests->{$id}->wheel->get_driver_out_messages ) { + $kernel->yield( 'got_flush', $id ); + } return; }
This was fixed in abf359178399cbeb32522853690abd797e91dfcd - v2.12. Issue can be closed On Wed May 04 17:49:12 2011, brewt wrote: Show quoted text
> Since the pod isn't complete for how to properly stream, I'm not 100% > sure this patch is correct, but here goes anyways. > > After you've completed streaming and you call DONE, it always yields > got_flush regardless if POE::Wheel::ReadWrite has something left in its > buffer to flush. Executing the got_flush event when it has data left in > its buffer leads to SimpleHTTP resetting/closing the connection > prematurely. This patch fixes it by allowing ReadWrite to flush the > last chunk itself. > > Adrian > > --- POE/Component/Server/SimpleHTTP.pm.orig 2011-05-03 > 17:53:56.000000000 -0700 > +++ POE/Component/Server/SimpleHTTP.pm 2011-05-03 17:54:03.000000000 -0700 > @@ -902,7 +902,9 @@ > $self->_requests->{$id}->set_streaming(0); > $self->_requests->{$id}->set_done(1); # Finished streaming > # TODO: We might not get a flush, trigger it ourselves. > - $kernel->yield( 'got_flush', $id ); > + if ( !$self->_requests->{$id}->wheel->get_driver_out_messages ) { > + $kernel->yield( 'got_flush', $id ); > + } > return; > } >
Resolved.