Closed Bug 417841 Opened 16 years ago Closed 14 years ago

setRequestHeader does not overwrite default value of Cache-Control: no-cache on post requests

Categories

(Firefox :: General, defect)

2.0 Branch
x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: ru.eriksen, Unassigned)

Details

(Whiteboard: [CLOSEME 2010-07-30])

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

Trying to cache a POST response from an XMLHttpRequest, but can not overwrite default value of Cache-Control: no-cache. The same is true for Pragma: no-cache.
It ends up something like Cache-Control: erik, no-cache
This is only true for POST _not_ for GET.

I have deactivated all of my extensions except firebug. 

var httpRequest = new XMLHttpRequest();
httpRequest.open('POST', 'search/cards', true);
httpRequest.setRequestHeader('Cache-Control', erik');
httpRequest.send(...);

Here are some samples of the request and the response headers from Firebug:

Response Headers
Date	Sat, 16 Feb 2008 00:31:12 GMT
Server	Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.4
X-Powered-By	PHP/5.2.4
Expires	Sun, 17 Feb 2008 00:31:13 GMT
Cache-Control	max-age=86400
Content-Length	6463
Keep-Alive	timeout=5, max=98
Connection	Keep-Alive
Content-Type	text/html

Request Headers
Host	localhost
User-Agent	Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Accept	text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language	da,en-us;q=0.7,en;q=0.3
Accept-Encoding	gzip,deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	300
Connection	keep-alive
Content-Type	application/x-www-form-urlencoded
X-Requested-With	XMLHttpRequest
Cache-Control	erik, no-cache
Referer	http://localhost/magic/
Content-Length	62
Cookie	displayStyle=list; PHPSESSID=f5aaddfd801a58250209b204b9caac53
Pragma	no-cache

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
> httpRequest.setRequestHeader('Cache-Control', erik');
> Cache-Control    erik, no-cache

XMLHttpRequest SPEC says;
> http://www.w3.org/TR/XMLHttpRequest/#setrequestheader
> setRequestHeader(header, value), method
>(snip)
>   The setRequestHeader() method appends a value if the HTTP header given
>   as argument is already part of the list of request headers.

Sorry but I couldn't find method to remove (a) a HTTP header from list of request headers, or (b) some values from a HTTP header in the list of request headers.
This bug was originally reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.6 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
http://www.mozilla.com
http://support.mozilla.com/kb/Managing+profiles
http://support.mozilla.com/kb/Safe+mode
Whiteboard: [CLOSEME 2010-07-30]
Version: unspecified → 2.0 Branch
No reply, INCOMPLETE. Please retest with Firefox 3.6.8 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.