一切正常,直到你发布值并获得:
[uwsgi-perl error] Bad Content-Length: maybe client disconnect? (45 bytes remaining) at /home/user/perl5/lib/perl5/Plack/Middleware/Debug/Parameters.pm line 20.
该应用程序的骨架是:
use Modern::Perl;
use HTML::Mason::PSGIHandler;
$app = sub {
my $env = shift;
$h = HTML::Mason::PSGIHandler->new(%mason_config);
$h->handle_psgi($env);
}
use Plack::Builder;
my $b = builder {
enable "Debug", panels => ['Parameters'];
$app;
}
导致此问题的原因是什么?
答案 0 :(得分:0)
这意味着您的CGI :: PSGI在Plack :: Request(由Plack :: Middleware :: Debug :: Parameters使用)之前读取STDIN。
要在您的应用程序中解决此问题,您必须致电:
Plack::Request->new($env)->body_parameters;
use Modern::Perl;
use HTML::Mason::PSGIHandler;
$app = sub {
my $env = shift;
$h = HTML::Mason::PSGIHandler->new(%mason_config);
Plack::Request->new($env)->body_parameters; #<<<WORKAROUND
$h->handle_psgi($env);
}
use Plack::Builder;
my $b = builder {
enable "Debug", panels => ['Parameters'];
$app;
}
Plack::Request
将读取正文并将其恢复至$ env-&gt; {&#39; psgi.input&#39;}将STDIN
替换为{{1} }}。所以CGI的Stream::Buffered
没有注意到变化:
参见 PSGI :: CGI
$self->read_from_client(...)