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 2014/12/13 16:41:57 UTC
[Bug 57347] New: AJP response contains wrong status reason phrase
https://issues.apache.org/bugzilla/show_bug.cgi?id=57347
Bug ID: 57347
Summary: AJP response contains wrong status reason phrase
Product: Tomcat 8
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: Connectors
Assignee: dev@tomcat.apache.org
Reporter: rainer.jung@kippdata.de
This problem applies to TC 8 and 9:
I get AJP responses with status code 200 but wrong reason phrase "ACT" instead
of "OK".
The problem is due to the MessageBytes tmpMB being used in AbstractAjpProcessor
first in prepareResponse() for processing the request, then in
prepareResponse() for setting the reason phrase.
During prepareRequest() only the byte (ByteChunk) functionality of tmpMB is
used, during prepareResponse() the String functionality. Now appending the
reason phrase to the AJP message is done using AjpMessage.appendBytes(). This
function has changed between TC 7 and TC 8 to support multiple charsets
(r1630910).
In TC 7 when the MessageBytes is of type T_STR, which is the case here, the
append does:
appendString(mb.toString());
After the change in TC 8 it calls
mb.toBytes();
and then uses the ByteChunk in mb. The implementation of mb.toBytes() checks,
whether the ByteChunk already set before (isSet) and then doesn't do the string
to ByteChunk conversion. Since the MessageBytes tmpMB was used before to read
request headers and attributes, it already has a ByteChunk set, so the
conversion is skipped and the old value of the ByteChunk is used. As a result
the value of the last part read from the request - in my case the string "ACT"
is appended as the status reason phrase.
I suggest to not change the behavior in AjpMessage.appendBytes() but instead
recycle the tmpMB MessageBytes before using it in
AjpProcessor.prepareResponse() (TC 9) resp.
AbstractAjpProcessor.prepareResponse() (TC 8).
--- java/org/apache/coyote/ajp/AjpProcessor.java (revision 1645245)
+++ java/org/apache/coyote/ajp/AjpProcessor.java (working copy)
@@ -1388,6 +1388,7 @@
response.setCommitted(true);
+ tmpMB.recycle();
responseMsgPos = -1;
responseMessage.reset();
responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);
Regards,
Rainer
--
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
[Bug 57347] AJP response contains wrong status reason phrase
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57347
Rainer Jung <ra...@kippdata.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Rainer Jung <ra...@kippdata.de> ---
Fixed for TC 9 and TC 8 (8.0.16) with r1645247 resp. r1645248.
--
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
[Bug 57347] AJP response contains wrong status reason phrase
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57347
Victor <sy...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sys.viktor@gmail.com
--- Comment #2 from Victor <sy...@gmail.com> ---
*** Bug 57443 has been marked as a duplicate of this bug. ***
--
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