4

問題は、注文のエクスポートをフィルタリングすると、GoogleChromeで次のエラーが発生することがあることです。

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.

私はSales > Orders画面について話している。

注文番号でフィルタリングして、実際の注文を1つだけ.csvファイルにエクスポートするとします。

FF、IEなどではこれは機能するようです。また、ほとんどの場合、Chromeでも機能します(16-この投稿の時点での最新バージョン)。

この投稿によると:「サーバーから受信した重複ヘッダー」EPPlus2.9を使用したChrome16のエラーで、彼はそれがデリメータとしての「、」と関係があると推測できました。

lib/Varien/File/Csv.phpデリメータを「;」に変更してみました。しかし、それはうまくいかなかったようです...

誰か提案がありますか?

注: Chrome自体にはいくつかの修正がありますが(私は思う)、可能であればMagentoを介して修正したいと思います。

4

1 に答える 1

8

その場合、magentoはヘッダーを正しく送信しなかったようです。

ここでは「ファイル名のコンマ」のバグではありませんが、Magentoが同じヘッダーを2回送信しているように見えます。

この問題は、の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'));

$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);

この変更をコアクラスに適用せずに、このクラスのコピーを作成してここに配置するのが最善です/app/code/local/Mage/core/Controller/Varien/Action.php

このバグはMagento1.7の次のリリースで修正されるようです。

于 2012-03-07T14:37:03.093 に答える