Closed davewood closed 3 years ago
seems to be a Dancer bug and should be reported there.
thank you for the pointer. -> https://github.com/PerlDancer/Dancer2/issues/1566
actually, re-reading the stacktrace the error does occur inside Plack. it seems you're using Apache mod_perl2 and i assume the error won't happen in a non mod_perl environment. Which version of mod_perl are you using?
rts@dtdev:~$ perl -Mmod_perl2\ 999
mod_perl2 version 999 required--this is only version 2.000010.
BEGIN failed--compilation aborted.
this is probably a bug in Plack::Handler::Apache2 but I personally haven't touched mod_perl2 for quite a while and have no resource available to look into fixing it. if someone can take a look and send a patch i can happily review and merge it.
I think this is a bug in Plack::Request or HTTP::Entity::Parser.
Plack::Handler::Apache2 provides a psgi.input
that doesn't support ->seek
, and it also doesn't set psgix.input.buffered
so this should be fine. Plack::Request tries to parse this using HTTP::Entity::Parser. If no content type is provided, HTTP::Entity::Parser does nothing and makes no changes to the env hash. If a content type is provided it will try to parse the body, possibly using a fallback noop parser. It also replaces psgi.input
with a Stream::Buffered if psgix.input.buffered
is false. This replacement does happen for unsupported content types, just not when the content type is not specified.
Plack::Request then assumes it can call ->seek
on psgi.input
. But if no content type was provided, psgix.input.buffered
and psgi.input
won't have been updated, and ->seek
isn't guaranteed to work.
ah that sounds about right - can anyone supply a patch for that? :)
Does it seem better to have Plack::Request cope with a non-buffered input after attempting to parse the body, or should HTTP::Entity::Parser always set up psgi.input
to be buffered?
i think i prefer fixing HTTP::Entity::Parser to behave in a more consistent manner. @kazeburo ?
The fix for this has been released to CPAN in 1.0048.
Does that handle e.g. CONTENT_TYPE=1 somewhat gracefully?
i don't know what you mean but it's handled the same as when Content-Type: foo
was specified.
curl -X POST -d '{}' https://dtdev:8080/v1/dnscheck
this works because curl sends a default Content-Type header but if I make curl omit the default header I get this error.
curl -X POST -d '{}' https://dtdev:8080/v1/dnscheck -H 'Content-Type:'