You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2005/04/25 18:07:20 UTC

DO NOT REPLY [Bug 32604] - Some httpHeaders can be lost in response

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





------- Additional Comments From jan.luehe@sun.com  2005-04-25 18:07 -------
One (probably unintended) side effect of SRV.5.5, 2nd bullet, is that
even when response.setContentLength(0) is not called explicitly, but
the response's content length is set to 0 via
response.setHeader("Content-Length", "0"), as in the following code
snippet:

  response.setHeader("Host", "localhost");
  response.setHeader("Pragma", "nocache");
  response.setHeader("Content-Length", "0");
  response.setHeader("location", "http://www.apache.org");

any subsequently setHeader() calls are ignored.

This is not intuitive, because HTTP response headers should be
settable in any order.

I suggest we amend SRV.5.5, 2nd bullet, in the upcoming Servlet Maintenance
release, as follows:

  The amount of content specified in the setContentLength method of the
  response [ADD: has been greater than zero] and has been written to the
  response

Unless there are any objections, I am going to apply the following
patch:

Index: Response.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Response.java,v
retrieving revision 1.11
diff -u -r1.11 Response.java
--- Response.java       31 Mar 2005 10:31:53 -0000      1.11
+++ Response.java       25 Apr 2005 16:03:48 -0000
@@ -315,7 +315,7 @@
      */
     public boolean isAppCommitted() {
         return (this.appCommitted || isCommitted() || isSuspended()
-                || ((getContentLength() != -1) 
+                || ((getContentLength() > 0) 
                     && (getContentCount() >= getContentLength())));
     }

Please let me know.


Jan

-- 
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: DO NOT REPLY [Bug 32604] - Some httpHeaders can be lost in response

Posted by Remy Maucherat <re...@apache.org>.
bugzilla@apache.org wrote:
> ------- Additional Comments From jan.luehe@sun.com  2005-04-25 18:07 -------
> One (probably unintended) side effect of SRV.5.5, 2nd bullet, is that
> even when response.setContentLength(0) is not called explicitly, but
> the response's content length is set to 0 via
> response.setHeader("Content-Length", "0"), as in the following code
> snippet:
> 
>   response.setHeader("Host", "localhost");
>   response.setHeader("Pragma", "nocache");
>   response.setHeader("Content-Length", "0");
>   response.setHeader("location", "http://www.apache.org");
> 
> any subsequently setHeader() calls are ignored.
> 
> This is not intuitive, because HTTP response headers should be
> settable in any order.
> 
> I suggest we amend SRV.5.5, 2nd bullet, in the upcoming Servlet Maintenance
> release, as follows:
> 
>   The amount of content specified in the setContentLength method of the
>   response [ADD: has been greater than zero] and has been written to the
>   response
> 
> Unless there are any objections, I am going to apply the following
> patch:
> 
> Index: Response.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Response.java,v
> retrieving revision 1.11
> diff -u -r1.11 Response.java
> --- Response.java       31 Mar 2005 10:31:53 -0000      1.11
> +++ Response.java       25 Apr 2005 16:03:48 -0000
> @@ -315,7 +315,7 @@
>       */
>      public boolean isAppCommitted() {
>          return (this.appCommitted || isCommitted() || isSuspended()
> -                || ((getContentLength() != -1) 
> +                || ((getContentLength() > 0) 
>                      && (getContentCount() >= getContentLength())));
>      }

+1.

Rémy

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