繁体   English   中英

Perl代码输出在IIS和Apache中的行为不同

[英]Perl code output behave differently in IIS and Apache

我有Perl脚本,它使用以下命令设置标题

print "Content-Disposition: attachment; filename=test.csv\n\n";

部署在Web服务器IIS和Apache上时,此脚本的行为有所不同。

当代码部署在apache网络服务器上时,我能够在android mobile上下载文件test.csv。

但是,如果将相同的脚本部署在IIS服务器上,则在Android移动设备上下载始终不会成功。

注意:在两个Web服务器的任何桌面浏览器中,下载过程都像魅力一样。

以下是来自IIS的响应标头

(Status-Line)   HTTP/1.1 200 OK
 Server Microsoft-IIS/6.0
 Content-Disposition    attachment; filename=test.csv
 X-Powered-By   ASP.NET
 Date   Thu, 31 Jan 2013 10:10:59 GMT
 Connection close

以下是来自Apache的响应标头

(Status-Line)   HTTP/1.1 200 OK
 Date   Thu, 31 Jan 2013 10:12:33 GMT
 Server Apache/2.2.22 (Win32)
 Content-Disposition    attachment; filename=test.csv
 Keep-Alive timeout=5, max=100
 Connection Keep-Alive
 Transfer-Encoding  chunked
 Content-Type   text/plain

谁能帮助我解决这个问题?

谢谢!

非常感谢您的支持。

我尝试遵循perl代码,它帮助我解决了问题

# Set the header using following way
print "Content-Type: text/plain", "\n";
print "Content-length: $length", "\n";
print "Content-Disposition: attachment; filename=test.csv\n\n";

注意:$ length是一个变量,用于存储文件内容的长度,如下所示

my $csv = "testing";
my $length = length $csv;

谢谢!

似乎其他人也难以从IIS服务器下载到Android:

http://code.google.com/p/android/issues/detail?id=33362

.apk IIS Webserver在Android 2.3.x上下载错误

http://www.experts-exchange.com/Programming/Languages/Java/Android/Q_27592118.html

我认为这不是Perl的问题。 不过,我没有找到解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM