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

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

Hi Oleg,

Thanks for the quick reply. However one might doubt whether the solution is 
really that easy. I don't think the spec is 100% clear on this issue. Section 
4.1 specifies the message body optional; section 4.3 says that "The presence of 
a message-body in a request is signaled by the inclusion of a Content-Length or 
Transfer-Encoding header field in the request's message-headers." We all know 
that POST messages usually have a message body, but I don't think we can read 
from the spec that it MUST have one.

If in doubt, might I suggest that a better solution could be to handle an 
entity enclosing request without message body by using a LengthDelimitedDecoder 
and a length of 0. This should also work out of the box and ensure the 
'obviously expected behavior'.

-Roland
                
> 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
>             Fix For: 4.2-beta2
>
>
> 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