[jcifs] [Bug 20307] - Setting content length causes Tomcat to
ignore response status
eglass1 at attbi.com
eglass1 at attbi.com
Fri May 30 20:58:54 EST 2003
This is the follow-up regarding the Tomcat 5.0 bug earlier. This is a
specification item; according to the Servlet spec:
"When a response is closed, the container must immediately flush all remaining
content in the response buffer to the client. The following events indicate
that the servlet has satisfied the request and that the response object is to
be closed:
The termination of the service method of the servlet.
The amount of content specified in the setContentLength method of the
response has been written to the response.
The sendError method is called.
The sendRedirect method is called."
So when we call setContentLength(0), the response is effectively closed;
subsequent attempts to set status and headers are ignored (since the response
has been committed).
Attached is a fixed NtlmSsp.java which moves the setContentLength(0) call to
the appropriate location.
I don't know that this is critical, except to people like Marc that are using
Tomcat 5.0; there is a possibility that other containers would exhibit similar
behavior, however, since this isn't a new spec item. I'll leave it up to Mike
to decide whether this warrants yet another release, or if it can wait awhile
to see if any other issues come up.
Also attached is an updated NtlmHttpServletRequest.java, which overrides
getAuthType() to return "NTLM" (this was tested successfully).
Eric
---------------------- Forwarded Message: ---------------------
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
remm at apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From remm at apache.org 2003-05-30 10:17 -------
It took me about 15 minutes to figure out what was going on.
The response is considered committed as soon as the amount of bytes specified in
the content length has been written. Since the content length is 0, the response
is considered committed as soon you call response.setContentLength(0). Since you
can't change the status after the response has been committed, that's why you
get a 200 status back.
This spec seems a bit weird in that case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 3713 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20030530/97b443e8/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 1469 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20030530/97b443e8/attachment-0001.obj
More information about the jcifs
mailing list