ZF-4526: Capitalization of headers breaks file uploads

Issue Type: Bug Created: 2008-10-08T15:02:23.000+0000 Last Updated: 2012-03-16T06:53:06.000+0000 Status: Resolved Fix version(s): - 1.6.2 (13/Oct/08)

Reporter: Alex Adriaanse (alexadriaanse) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Http_Client

Related issues: Attachments:


When uploading files to a particular web application I'm working with using Zend_Http_Client, the web application does not see the files that I'm uploading using $zendHttpClient->setFileUpload(). However, if I change the Content-type header for the file part(s) to "Content-Type" (with a capital "T"), and the Content-disposition header to "Content-Disposition" (with a capital "D"), the file and its type is recognized. I've verified that the capitalization of both headers must be changed in order for the web application to recognize the files.

I realize that this is probably a bug in the web application I'm interfacing with, but unfortunately I don't have control over that application. According to my tests, at least IE 7 uses the Content-Type (capital "T") and Content-Disposition (capital "D") headers.

Changing the capitalization of these headers in Zend/Http/Client.php @ r11407 on lines 1012 and 1130 appears to fix this.


Posted by old of Satoru Yoshida ( on 2008-10-08T22:17:34.000+0000

Change as following in SVN r11768

  1. Create 2 constants, CONTENT_TYPE and CONTENT_LENGTH. Use CONTENT_TYPE instead of 'Content-type' and CONTENT_LENGTH instead of 'Content-length'.
  2. Change from 'Content-disposition' to 'Content-Disposition' . Capitalization of 'D'.
  3. Change from 'User-agent' to 'User-Agent' . Capitalization of 'A'.

Posted by Shahar Evron (shahar) on 2008-10-12T01:36:05.000+0000

I don't mind the change but hell, all standards (namely the HTTP RFC) clearly states that headers case is to be ignored and that headers are case insensitive. It doesn't matter what IE sends, what matters is what the standards say, and I would personally leave it all lower case.

The bug is in the app you are working with, and they are likely to have problems with other clients.

That said, I don't mind the change - but what happens if someone comes along in a month saying the app they are working with expects other capitalization? do we change it again? Perhaps we should come up with a way to customize this (e.g. static properties that define these headers which can be overridden through inheritance).

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.