Handling of HEAD requests
-------------------------

                 Key: HTTPCORE-66
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-66
             Project: HttpComponents Core
          Issue Type: Bug
          Components: HttpCore NIO
            Reporter: Steffen Pingel
         Attachments: httpcore-nio-head-request.patch

I noticed that there currently is no test case that sends HEAD requests in the 
NIO package. I have attached a simple test case that sends GET requests 
followed by HEAD requests and compares the received headers.

The patch also contains modifications of httpcore-nio to make the test case run 
successfully. The tricky part on the server side is that the request method 
(which is only stored in HttpRequest) needs to be known when sending the 
response. Also HEAD responses must not contain a body but in order to send 
correct headers information about the entity such as content length and 
encoding needs to be known when processing headers. 

The patch is a first attempt to fix this and needs more refinement, e.g. 
instead of setting the entity to null in 
BufferingHttpServiceHandler.sendResponse() extending 
NHttpServerConnection.submitResponse() with a boolean flag that determines if a 
body should be sent might be a preferable option.

On the client side similar problems exist. The client connection needs to be 
aware if a body is to be expected when receiving a response (which depends on 
the request method of the request). The patch adds a boolean field to 
DefaultNHttpClientConnection to track this, but that will fail if requests are 
pipelined. Instead NHttpClientHandler.responseReceived() could return a boolean 
value that signals if a body is expected or not.






-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to