Oops, round n+1

dws on 2002-10-18T22:15:31

I'm hacking up something with HTTP::Daemon, and discovered that send_file() doesn't fly if you pass it a filename. (It's normally called from send_file_response(), which passes send_file() a reference to a glob instead of a filename.) Within send_file(), if you pass a filename, the file handle it uses gets prematurely delocalized, sysread() fails, and nothing gets sent down the socket. Take a look at the code. See it? I didn't at first.

So, my first ever submission to rt.cpan.org and I submit a patch that fixes my weird case but breaks the normal case. Oops. The second patch should do the trick.

Next up is to figure out how to use HTTP::Daemon along with IO::Select, so that I handle multiple sockets simultaneously in a non-forking situation, while honoring Connection: keep-alive. I hear the sound of a wheel being reinvented, but I'm doing something custom, and want to distribute it as a single file that runs on top of a standard distribution.