You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by J Ross Nicoll <jr...@dcs.st-and.ac.uk> on 2006/07/21 16:18:12 UTC

Problems with always sending Content-Type, Expires and Pragma headers

I've been adapting my web application to handle the Range and If- 
Range headers. Problem is, if I send back a 206 response (partial  
content), sometimes I don't want to be sending Content-Type.  
Specifically, from RFC 2616, section 10.2.7:

"If the response is the result of an If-Range request that used a  
weak validator, the response MUST NOT include other entity-headers;  
this prevents inconsistencies between cached entity-bodies and  
updated headers."


Now; I may not entirely agree that this is a good idea, but that's  
what the spec says, and Content-Type is one of the "other entity- 
headers". However, if I don't specify a Content-Type, Tomcat (5.5.17)  
sets it to text/plain . So, I'm looking for Tomcat not to auto-set  
Content-Type in some cases. I'm saying this in e-mail, rather than  
submitting a bug report, because I'm not entirely sure of the best  
solution to this.

Now the simplest solution would, of course, be to not send Content- 
Type automatically on status code 206. However, that would break any  
applications that have come to depend on such behaviour. Also, I have  
a separate problem with Expires and Pragma always being sent on  
secure connections; while Expires can be overriden, Pragma should be  
excluded if not suitable.

The best solution I can think of to all these problems, would be to  
make headers to always be sent, a configuration option on the HTTP  
and AJP connectors. Thoughts?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org