DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=32604>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=32604 Summary: Some httpHeaders can be lost in response Product: Tomcat 5 Version: 5.0.30 Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Connector:Coyote AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If you set the content-length to a very small value before setting headers in the httpResponse, they are all lost. In my case: The following actions are done in my code (a proxy) .. handleResponse(HttpServletRequest request, HttpServletResponse response) .. response.setHeader("Host", "localhost"); response.setHeader("Pragma", "nocache"); response.setContentLength(0); response.setHeader("location", "http://www.apache.org"); ... I sniff the http strean and the location field is lost. It's lost because the response is considered committed after setting the conten- length to zero and the actual set of the header is only done when the response is not committed: in class org.apache.coyote.tomcat5.CoyoteResponse we have public void setHeader(String name, String value) { if (isCommitted()) return; // Ignore any call from an included servlet if (included) return; coyoteResponse.setHeader(name, value); } I deep into the code and found the following that isCommitted calls isAppCommitted: public boolean isAppCommitted() { return (this.appCommitted || isCommitted() || isSuspended() || ((getContentLength() != -1) && (getContentCount() >= getContentLength()))); } If the header has already been written (that's my case but i don't know why) the ((getContentLength() != -1) && (getContentCount() >= getContentLength())) predicate is returning true. I think this can also happens for example with a small text file in response with huge header and by settings the content-length at the beginning. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]