|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re^3: Strange blocking issue with HTTP::Daemonby Anonymous Monk |
| on Sep 26, 2012 at 16:51 UTC ( #995822=note: print w/ replies, xml ) | Need Help?? |
|
Replying to an ancient post but this is little to do with HTTP::Daemon. The issue is that once you have accepted a connection you loop processing its requests until it goes away. With the LWP::UserAgent it appears to close the connection after each request but a web browser will attempt to keep the connection open meaning your code will block on the get_request. The example code in the HTTP:Daemon synopsis is the problem. The code below is how I use HTTP::Daemon. Instead of blocking in the get_request call I put the daemon and client connections in an IO::Select object and block on that and only process data from those that are ready. That way a single threaded server can appear to be processing data concurrently from multiple connections including regular browsers that will keep the connection open.
Now back to investigating the problem I was originally looking at. Why does get_request block on malformed / incomplete requests.......
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||