[英]Apache returning malformed header from script for Perl CGI script
I am running a perl script on an Apache httpd server and intermittently I get 500 Internal Server Error.我在 Apache httpd 服务器上运行 perl 脚本,间歇性地收到 500 Internal Server Error。
When I check the error log, I see below error:当我检查错误日志时,我看到以下错误:
Mon Feb 22 15:04:25 2021] [error] [client xxx.xxx.xx.xx ] malformed header from script. Bad header=Can I override this?: test.cgi
Can someone please let me know what could have went wrong?有人可以让我知道可能出了什么问题吗?
This first text that a CGI program should print to STDOUT
is the CGI headers (which will probably include Content-type:
). CGI 程序应该打印到
STDOUT
的第一个文本是 CGI 标头(可能包括Content-type:
)。
It seems that under some circumstances, your program prints the string "Can I override this?"似乎在某些情况下,您的程序会打印字符串“我可以覆盖这个吗?” before those headers.
在那些标题之前。 The web server tries to parse that string as a header, fails and throws an error.
web 服务器尝试将该字符串解析为 header,但失败并引发错误。
Look at your code, find out why it is printing that string and either stop it from doing so or ensure that the correct headers are printed first.查看您的代码,找出它打印该字符串的原因,然后阻止它这样做或确保首先打印正确的标题。
Without seeing your code, it's hard to be much more help.如果没有看到您的代码,很难获得更多帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.