[ 
https://issues.apache.org/jira/browse/HTTPCORE-296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13227697#comment-13227697
 ] 

Roland Hänel commented on HTTPCORE-296:
---------------------------------------

Additional information / correction:

This does *not* happen if a Content-Length: 0 header is included with the 
request. If the request has a CL: 0 header, everything is fine.

The problem happens if the request (POST) does not include any Content-Length: 
header. This seems to be the default implementation in the Python 2.7 (sic!) 
client when sending a POST request with zero bytes of request data.

In this case (no CL header at all in the request), HttpCore does not select the 
LengthDelimitedDecoder but the IdentityDecoder, which in turn never reaches the 
complete state. 

The solution might be to select the the LengthDelimitedDecoder with a target 
len of 0 in this case.
                
> IdentityDecoder fails to consume as POST request with Content-Length 0 (zero)
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-296
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-296
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.2-alpha2
>            Reporter: Roland Hänel
>
> If a client submits a POST with Content-Length 0, the HttpCore framework will 
> fire the onContentReceived(...) method of the HttpAsyncRequestConsumer once. 
> However, the decoder (passed as an argument to onContentReceived()) will 
> never enter the "completed" state, because no bytes will actually be received 
> from the client. However, reaching the "completed" stage of the decoder is an 
> requirement for the HttpAsyncServiceHandler to finally process the request 
> (i.e., call the handle(...) method).
> This leads to the (incorrect) behavior that it is impossible to handle a POST 
> request with Content-Length 0 in HttpCore NIO.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to