hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Handling 204 Response with Body
Date Tue, 29 Mar 2016 13:38:42 GMT
On Fri, 2016-03-25 at 16:29 +0530, Senduran wrote:
> Hi all,
> Some backend responses the '204 No content' status code with body (yes,
> clearly spec violation)
> In our targetHandler
> <https://svn.wso2.org/repos/wso2/carbon/platform/tags/turing-chunk08/dependencies/synapse/2.1.2-wso2v5/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java#L200>
> we check(isResponseHaveBodyExpected) for some status code (204, 205 and
> 304) and assumes those will not contain body and continue the rest. Once we
> find those status code we call resetInput()
> <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.httpcomponents/httpcore-nio/4.2.3/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?av=f#146>.(But
> it didn't clear the sessionInputBuffer)
> Every thing works fine, unless such spec violation happens. Once the 204
> comes with a message body, the sessionInputBuffer is filled with the
> content. and no one will consume it. So when the 2nd response comes (using
> the same connection) it will use the same session input buffer and will get
> a corrupted data. (in this case we are getting protocol violation
> exception, since the 1st 204 response's body is prepended to the 2nd
> response's status line)
> What would be best way to fix this
> Thanks
> Senduran


I do not think there is a way to make the same transport work reliably
with 204 status messages that violate the spec and those that are spec

Standards exist for a reason.


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

View raw message