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 2011/02/09 22:48:09 UTC

DO NOT REPLY [Bug 50748] New: Ignoring setContentLength( ) when using writer is incomplete

https://issues.apache.org/bugzilla/show_bug.cgi?id=50748

           Summary: Ignoring setContentLength( ) when using writer is
                    incomplete
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: knst.kolinko@gmail.com


Reviewing o.a.c.connector.Response after comments in
https://issues.apache.org/bugzilla/show_bug.cgi?id=50747#c3

In o.a.c.connector.Response there is a feature that
Response#setContentLength(int) ignores the call if usingWriter flag is true.


My comments are:

1) It concerns only multi-byte charsets such as UTF-8. There is nothing wrong
with calling setContentLength() if it is a single-byte charset.

2) There is no such protection in Response#setHeader(), #setIntHeader(),
#addHeader(), #addIntHeader() methods. Calling them will bypass the protection.

See how o.a.coyote.Response implements those methods and
o.a.coyote.Response#checkSpecialHeader() for comparison.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 50748] Ignoring setContentLength( ) when using writer is incomplete

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50748

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |frank.schroeder@gmail.com

--- Comment #1 from Mark Thomas <ma...@apache.org> 2011-02-09 17:19:52 EST ---
*** Bug 50747 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 50748] Ignoring setContentLength( ) when using writer is incomplete

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50748

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2011-02-09 17:40:44 EST ---
This fixed in 7.0.x and will be included in 7.0.9 onwards.

Both single and multi-byte encodings are handled since OutputBuffer.close()
sets the content-length to the number of bytes, not the number of characters.

I suspect the test in the response dates from a time when content length was
set using characters although I haven't done the code archeology to be sure of
that.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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