为什么第二个请求不完成输出? [英] Why second request do not finish output?
问题描述
浏览器等待来自服务器和记录一些数据后,才重新启动服务器完成。此外,我看到孩子的月均分叉。
The browser wait for some data from server and logging is done only after server restart. Also I see may childs are forked.
$ah{ $r->hostname } ||= HTML::Mason::ApacheHandler->new ( .. )
sub handle{
eval{ $ah{ $r->hostname }->handle_request($r); };
if( $@ ) {
$r->filename( $r->document_root . '/errors/500.html' );
$ah{ $r->hostname }->handle_request($r); };
$r->log_error( 'ERROR' );
}
}
我做错了什么,使他们没有完成?
What I do wrong so they are not finished?
UPD
我已经发现了大约同样的问题只有一个音符: http://sourceforge.net/p/石匠/邮差/消息/ 14999444 / ,但没有任何线索。
推荐答案
的http://foertsch.name/ModPerl-Tricks/custom-content_type-with-custom_response.shtml
所以,强似错误文本直接custom_response我们把它存放在pnotes并设置其他未使用的URI,说/ - /错误,因为custom_response:
So, instead of passing the error text directly to custom_response we store it in pnotes and set an otherwise unused URI, say /-/error, as custom_response:
sub handler {
my ($r)=@_;
@{$r->pnotes}{qw/etext ect/}=("sorry, no access\n", 'text/plain; charset=my-characters');
$r->custom_response( 403, "/-/error" );
return 403;
}
现在,我们需要配置/ - /错误运行Perl处理器:
Now, we need to configure /-/error to run a Perl handler:
<Location /-/error>
SetHandler modperl
PerlResponseHandler My::Error
</Location>
和,当然,我们需要处理函数,我::错误::处理程序:
And, of course, we need the handler function, My::Error::handler:
sub handler {
my ($r)=@_;
return Apache2::Const::NOT_FOUND unless $r->prev;
$r->content_type($r->prev->pnotes->{ect});
$r->print($r->prev->pnotes->{etext});
return Apache2::Const::OK;
}
该解决方案似乎工作,但我不知道从主要问题的答案了:为什么请求没有完成
This solution seems to work, but I do not know the answer from main question yet: Why request is not finished?
UPD
这似乎与mod_perl2错误
https://bz.apache.org/bugzilla/show_bug.cgi?id=57976
That seems a bug with mod_perl2 https://bz.apache.org/bugzilla/show_bug.cgi?id=57976
这篇关于为什么第二个请求不完成输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!