You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "James Leigh (JIRA)" <ji...@apache.org> on 2010/03/04 22:03:27 UTC

[jira] Issue Comment Edited: (HTTPCORE-219) HttpRequestParser Fails to Detect Requests Without a Message Body

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

James Leigh edited comment on HTTPCORE-219 at 3/4/10 9:02 PM:
--------------------------------------------------------------

I am talking about some _arbitrary_ _non-standard_ methods, but I am referring to the _standard_ HTTP messaging (not its methods).

The problem I encountered is that if HttpEntityEnclodingRequest is used and there is no message-body (i.e. no Content-Length or Transfer-Encoding headers), the method NHttpRequestHandler#entityRequest is called, but the methods ConsumingNHttpEntity#consumeContent and NHttpRequestHandler#handle are never called because there is no message-body to read. This is unexpected behaviour (to me) and was not easily tracked down.

Since httpCore detects the message-body differently then the HTTP spec I thought I would post this bug report so that others might not encounter this problem in the future.

The solution I did implement is to override
DefaultServerIOEventDispatch, DefaultNHttpServerConnection,  and HttpRequestParser to replace the HttpEntityEnclosingRequest object if there is no message-body.

      was (Author: jleigh):
    I am talking about some _arbitrary_ _non-standard_ methods, but I am referring to the _standard_ HTTP messaging (not its methods).

The problem I encountered is that if HttpEntityEnclodingRequest is used and there is no message-body (i.e. no Content-Length or Transfer-Encoding headers), the method NHttpRequestHandler#entityRequest is called, but the methods ConsumingNHttpEntity#consumeContent and NHttpRequestHandler#handle are never called because there is no message-body to read. This is unexpected behaviour (to me) and was not easily tracked down.

Since httpCore detects the message-body differently then the HTTP spec I thought I would post this bug report so that others might not encounter this problem in the future.
  
> HttpRequestParser Fails to Detect Requests Without a Message Body
> -----------------------------------------------------------------
>
>                 Key: HTTPCORE-219
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-219
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0.1
>            Reporter: James Leigh
>
> The HttpRequestParser uses the request method to determine if the request has a message body. However, HTTP 1.1 states 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 header fields. The parser should be changed to use the header to determine if a message body is present.
> As is a POST or PUT request is received without a message body cannot be processed. Furthermore, a GET request with a message body cannot be processed either.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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