Subject: | correctly declared non-utf8 parameters in request break Catalyst |
Attached test case.
HTTP allows sending mulitpart/form-data requests in which each parameter declares its own encoding via a local content-type header.
Catalyst ignores that header, and always tries to decode using the application's encoding.
From IRC:
<ilmari> dakkar: yes, it should respect the content-type (and charset parameter) of each part, and only decode text ones
<ilmari> Catalyst::Request needs an analogue to Catalyst::Response's ->encodable_response
<ilmari> actually, that needs to happen at the part level for multipart/form-data
<ilmari> but HTTP::Body::MultiPart discards the headers :(
Subject: | en.pl |
#!/usr/bin/env perl
use strict;
use warnings;
package MyApp::Controller::Root {
use Moose;
BEGIN { extends 'Catalyst::Controller' };
sub index :Path(/) :Args(0) {
}
};
package MyApp {
use Moose;
extends 'Catalyst';
__PACKAGE__->setup('-Debug');
};
use Plack::Test;
use HTTP::Request::Common;
use Data::Dumper;
my $test = Plack::Test->create(MyApp->psgi_app);
my $req = POST '/',
Content_Type => 'form-data',
Content => [
foo => [
undef,'',
Content_Type=>'application/octet-stream',
Content => "\x89foobar",
],
];
print Dumper $req->as_string;
my $res = $test->request($req);
print Dumper $res;