Magento API Error: aborted: error parsing headers: duplicate header 'Content-Type' -
i upgraded server php 5.3 , fast cgi. unfortunately caused magento api return strange error
aborted: error parsing headers: duplicate header 'content-type'
i've tried various suggestions magento fourms no avail.
i'm running 1.4.0.1. suggestions how reconcile problem?
from http://www.magentocommerce.com/boards/v/viewthread/229253/
edit
app/code/core/mage/core/controller/response/http.php
and replace sendheaders() function following code (you're not supposed override core classes, working. using app/code/local/mage/... doesn't work because controller)
/** * transport object observers perform * * @var varien_object */ protected static $_transportobject = null; public function sendheaders() { if (!$this->cansendheaders()) { mage::log('headers sent: '.magedebugbacktrace(true, true, true)); return $this; } if (in_array(substr(php_sapi_name(), 0, 3), array('cgi', 'fpm'))) { // remove duplicate headers $remove = array('status', 'content-type'); // sent headers $sent = array(); foreach (headers_list() $header) { // parse name if (!$pos = strpos($header, ':')) { continue; } $sent[strtolower(substr($header, 0, $pos))] = true; } // raw headers $headersraw = array(); foreach ($this->_headersraw $i=>$header) { // parse name if (!$pos = strpos($header, ':')) continue; $name = strtolower(substr($header, 0, $pos)); if (in_array($name, $remove)) { // check sent headers if (isset($sent[$name]) && $sent[$name]) { unset($this->_headersraw[$i]); continue; } // check header if (isset($headers[$name]) && !is_null($existing = $headers[$name])) { $this->_headersraw[$existing] = $header; unset($this->_headersraw[$i]); } else { $headersraw[$name] = $i; } } } // object headers $headers = array(); foreach ($this->_headers $i=>$header) { $name = strtolower($header['name']); if (in_array($name, $remove)) { // check sent headers if (isset($sent[$name]) && $sent[$name]) { unset($this->_headers[$i]); continue; } // check header if (isset($headers[$name]) && !is_null($existing = $headers[$name])) { $this->_headers[$existing] = $header; unset($this->_headers[$i]); } else { $headers[$name] = $i; } // check raw headers if (isset($headersraw[$name]) && !is_null($existing = $headersraw[$name])) { unset($this->_headersraw[$existing]); } } } } parent::sendheaders(); }
Comments
Post a Comment