plack / Plack

PSGI toolkit and server adapters
http://plackperl.org/
Other
486 stars 214 forks source link

header object is constructed with things that aren't valid headers #703

Closed karenetheridge closed 8 months ago

karenetheridge commented 8 months ago

This can happen when processing a multipart request body, because HTTP::Entity::Parser::MultiPart does push @{$env->{'http.entity.parser.multipart.tempdir'}}, $dir; (where $dir is a File::Temp::Dir object).

..and then, Plack::Request constructs its headers by extracting content from $env, but it doesn't omit keys matching /./ (which aren't valid headers).

This manifested itself in my $work application via fluentd, which logs request headers, only in this case it encountered something that wasn't a string, therefore the middleware threw an exception (in Fluent::Logger and Data::MessagePack).

We'll fix it on our end by omitting headers with dots in them, but I think Plack::Request should do the same.

karenetheridge commented 8 months ago

thank you!

miyagawa commented 8 months ago

Thanks. Fixed in 1.0051.