我如何*阻止*Apache2设置Content-Type标头?

Nor*_*orm 5 apache content-type header http

我有一个CGI脚本在stdout上打印以下内容:

print "Status: 302 Redirect\n";
print "Server: Apache-Coyote/1.1\n";
print "Location: $redirect\n";
print "Content-Length: 0\n";
print "Date: $date\n\n";
Run Code Online (Sandbox Code Playgroud)

$ redirect和$ date是合理的值.Apache2实际发送的内容还包括Content-Type:标头(text/plain).我已经在服务器配置文件中注释掉了DefaultType.

我正在尝试调试在没有发送Content-Type:标头时出现的下游问题.那么为了防止 Apache2添加内容类型标题,我必须执行什么神奇的咒语?

cer*_*eri 3

根据我对 server/protocol.c 和 server/core.c 的(诚然简短的)阅读,你不能。

如果该标头不存在,它始终默认为 DefaultType(默认为文本/纯文本)。

  • CGI 会在命令行上运行吗?也许只是从 inetd 中运行上面的脚本? (2认同)