Hi all,
I was recently away without internet, but had some downtime. So I
decided to scratch an itch.
I have been using Twiggy as a test server for a framework and app that
I'm working on. However it involves WebDav, which requires HTTP 1.1. and
then things like Transfer-Encoding: chunked or Connection: keep-alive.
Originally I wrote a middleware module to use under twiggy and it sort
of worked, but the point of this email is, that I wrote a new anyevent
server implementation.
One can find it here:
http://yr.aran.eryri.ch/scratch/PxServer-AnyEvent-v0.5.0.tar.gz
Check the POD for a list of features. I am really happy with its
performance under the OS X webdav client.
I have a few questions:-
Why does the PSGI specs forbid an apps $env from having
HTTP_CONTENT_LENGTH or HTTP_CONTENT_TYPE?
My server always gives a buffered input stream and CONTENT_LENGTH gives
the number of bytes available in it. I thought that maybe some apps or
middleware would like to compare that with the original HTTP headers.
(Its a check my server does). I also thought I might do a magic number
mimetype check and set CONTENT_TYPE from that, but still keep the
original headers.
At the moment Plack's Lint module complains about the
HTTP_CONTENT_{TYPE,LENGTH}. My plan is to filter those headers out, if
loaded via its Plack::Handler module, but I was wondering why one would
want to remove any of the original headers?
WRT Transfer-Encoding, chunks are processed, CONTENT_LENGTH is set, but
I leave HTTP_TRANSFER_ENCODING as it is. I looked at the CGI RFC and
couldn't see if the PSGI spec got it from there.
My preference would be to leave all original headers available with the
HTTP_ prefix, all the info from the server is without that prefix.
Although the server scratches my itch, feedback is always welcome.
My other question is about naming. I'm not a fan of really deep
namespace paths names ABC::DEF::EFG::HIJ or names that give no hint as
to what the modules for.
So I was thinking about some short prefixes for various PSGI
parts/roles, followed by a name of the developers choice. In my case:
PxServer::AnyEvent or PxSvr::AnyEvent; - Linked above.
PxMidware::DeChunk; or PxMW::DeChunk; - Already mentioned, will upload.
PxFramework::ModMap or PxFW::ModMap; - Maps URLs to module names and
methods to subs within (includes WebDav support).
PxApp::Eluned - My web app.
Maybe PxServer::Twiggy ;-)
I have a pause account, but I thought I'd get some feedback before I
upload anything.
Regards,
Thorben