ZF-3515: Http client should reset Slug header (set when uploading file using APP)


When uploading a file using Zend_Gdata_App's post() method, a Slug header is added to the StaticHttpClient's headers. If you use the same Zend_Gdata_App instance to POST an atom entry ("application/atom+xml;type=entry") afterwards, the Slug header is also included in this request. This may confuse the server into believing that the request wants to upload a binary file, instead of sending data.

Simple solution, add the following line to Zend_Http_Client's resetParameters(): if (isset($this->headers['slug'])) unset($this->headers['slug']);


This is not a Zend_Http_Client fix - Zend_Http_Client is generic and the resetParameters() method will not reset any service-specific headers or parameters.

I think this should be fixed in Zend_Gdata by doing this after the request:

$this->_httpClient->('slug', null);

Not a Zend_Http_Client issue.

Thanks Bruno and Shahar.

This issue was fixed for ZF 1.6 in r9846, as part of the code to implement secure authsub and refactor some of the HTTP handling.

Please see: http://framework.zend.com/code/browse/…

We set the header to null before any HTTP request in line 472, before setting the parameters for the new request.

Thanks for the report!

Cheers, -Ryan

Marking as fixed for the 1.6.0 release.