Magento - 从服务器收到的重复标头

Geo*_*off 4 google-chrome magento export-to-csv magento-1.5

问题是,当我过滤订单导出时,有时我会在Google Chrome中收到此错误:

Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.
Run Code Online (Sandbox Code Playgroud)

我在谈论Sales > Orders屏幕.

假设我按订单号过滤它,这样我只想将1个实际订单导出到.csv文件.

在FF,IE等,这似乎工作.而且大多数时候它也适用于Chrome(16 - 最新版本发布时).

根据这篇文章:'从服务器收到的重复标题'在Chrome 16中与EPPlus 2.9的错误,他能够推断它与","作为分隔符有关.

我试着去lib/Varien/File/Csv.php改变界限到";" 但那似乎不起作用......

有人有什么建议吗?

注意: Chrome本身有一些修复(我认为),但如果可能,我想通过Magento修复它.

GiD*_*iDo 8

似乎magento在那种情况下没有正确发送标题.

这不是"文件名中的逗号"错误,但它看起来像Magento两次发送相同的标题.

您可以通过更改3行来解决此问题app/code/core/Mage/Core/Controller/Varien/Action.php.查看_prepareDownloadResponse方法并更改以下内容:

$this->getResponse()
->setHttpResponseCode(200)
->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true)
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"')
->setHeader('Last-Modified', date('r'));
Run Code Online (Sandbox Code Playgroud)

通过

$this->getResponse()
->setHttpResponseCode(200)
->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true)
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
->setHeader('Last-Modified', date('r'), true);
Run Code Online (Sandbox Code Playgroud)

最好不要将此更改应用于核心类,而是创建此类的副本并将其放在此处:/app/code/local/Mage/core/Controller/Varien/Action.php.

看起来这个bug 在Magento 1.7的下一个版本中修复.