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 2003/05/28 18:42:59 UTC
DO NOT REPLY [Bug 20307] New: -
Setting content length causes Tomcat to ignore response status
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20307>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20307
Setting content length causes Tomcat to ignore response status
Summary: Setting content length causes Tomcat to ignore response
status
Product: Tomcat 5
Version: Nightly Build
Platform: All
OS/Version: All
Status: NEW
Severity: Minor
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: eglass1@attbi.com
Setting the content length causes Tomcat to ignore subsequent status changes.
As an example:
import java.io.*;
import javax.servlet.http.*;
public class Test extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException {
response.setContentLength(0);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.flushBuffer();
}
}
This results in a response code of 200 (OK) rather than 401 (Unauthorized).
Doing:
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentLength(0);
results in the correct response code being sent.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org