jira-importer opened a new issue, #1111: URL: https://github.com/apache/httpcomponents-core/issues/1111
**[Steffen Pingel](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=spingel)** opened **[HTTPCORE-66](https://issues.apache.org/jira/browse/HTTPCORE-66?redirect=false)** and commented 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. --- **Affects:** 4.0-alpha4 **Attachments:** - [httpcore-nio-head-request.patch](https://issues.apache.org/jira/secure/attachment/12355860/httpcore-nio-head-request.patch) (_13.82 kB_) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
