Re: problem with PoCo::Server::SimpleHTTP
Lars Balker Rasmussen <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
On Sun, Oct 26, 2008 at 09:17:23PM +0100, Lars Balker Rasmussen wrote: > I'm trying to make a mini-webapp that basically has to take a url that maps > directly to a file, hold the connection until that file becomes available > (or time out), and return the contents. > > POE::Component::Server::SimpleHTTP's streaming mode seems ideal, and I have > a working implementation (based mostly on the example in the pod) on > > http://balker.dk/simplehttp.pl > > However, starting several streams at the same time will lead to only one of > them being closed, as if they share the session? > > To reproduce: > > # mkdir -p /tmp/root/static ; echo foo > /tmp/root/static/foo.txt > # perl simplehttp.pl > > and > > # wget -O foo.txt.1 http://localhost:8000/static/foo.txt & ; wget -O foo.txt.2 http://localhost:8000/static/foo.txt > > Both wgets will get the file contents, but only one will close the stream. > > Is there some kind of obvious mistake I'm making? Discussion with Chris on #poe led me to experiment with a non-streamed version (which is only a little bit cheating) http://balker.dk/simplehttp2.pl which gave me some insight: Starting the script without the foo.txt file in place, every new concurrent wget of the file (within the five second window currently in place) would lead the new event to override the old one, as per the debug output printing out the response-objects wheel-id. I assume this is much the same problem as with the streamed version of the script. -- Lars Balker Rasmussen Consult::Perl