【发布时间】:2015-01-17 11:56:29
【问题描述】:
我正在尝试使用 Apache 和 mod_perl 构建一个简单的异步 Web 服务。但是每次我尝试返回 HTTP 状态 202(已接受)时,都会出现错误。
下面是一个非常简单的例子(非异步):
package MyHandler;
use Apache2::Const '-compile' => qw 'OK HTTP_ACCEPTED HTTP_OK';
use Apache2::RequestRec;
use CGI;
sub handler {
my $r = shift;
print "Hallo";
$r->content_type('text/plain');
$r->status(Apache2::Const::HTTP_ACCEPTED);
return Apache2::Const::HTTP_ACCEPTED;
}
1;
我得到了错误
在本地主机上的浏览器中调用处理程序,我得到输出但也出现错误:
Hallo
Accepted
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
我也收到Apache2::Const::HTTP_OK 的错误,唯一没有错误的工作是Apache2::Const::OK。
我的 apache 错误日志没有提到这个错误。
【问题讨论】:
-
你的 apache 错误日志对此事有什么看法?
-
aah 忘了说:错误日志什么也没说!我会编辑帖子。
-
我觉得难以置信。
-
你试过 $r->print('foo'); ?
-
我试过了,和
print没有区别
标签: apache perl web-services http mod-perl