Return-Path: Delivered-To: apmail-jakarta-httpcomponents-dev-archive@www.apache.org Received: (qmail 40078 invoked from network); 22 Apr 2007 21:57:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Apr 2007 21:57:37 -0000 Received: (qmail 62641 invoked by uid 500); 22 Apr 2007 21:57:43 -0000 Delivered-To: apmail-jakarta-httpcomponents-dev-archive@jakarta.apache.org Received: (qmail 62611 invoked by uid 500); 22 Apr 2007 21:57:43 -0000 Mailing-List: contact httpcomponents-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list httpcomponents-dev@jakarta.apache.org Received: (qmail 62598 invoked by uid 99); 22 Apr 2007 21:57:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Apr 2007 14:57:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Apr 2007 14:57:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8005F71406C for ; Sun, 22 Apr 2007 14:57:15 -0700 (PDT) Message-ID: <26767888.1177279035521.JavaMail.jira@brutus> Date: Sun, 22 Apr 2007 14:57:15 -0700 (PDT) From: "Oleg Kalnichevski (JIRA)" To: httpcomponents-dev@jakarta.apache.org Subject: [jira] Commented: (HTTPCORE-66) Handling of HEAD requests In-Reply-To: <21229792.1177014435559.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HTTPCORE-66?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490754 ] Oleg Kalnichevski commented on HTTPCORE-66: ------------------------------------------- Hi Steffen, I had to tweak your patch a little before committing it. In particular I wanted to keep NHttp*Connection capable running in a full duplex mode. Therefore the NHttpClientConnection simply could not make an assumption about the current response being received matching the current request. I also think setting the entity to null when handling HEAD requests is perfectly okay. I personally prefer this to extending NHttpServerConnection.submitResponse() with a boolean flag, as I generally dislike methods that take boolean parameters. Besides, HEAD method is the only special case, which requires special handling of response entities. It is not worth polluting NHttp*Connection classes with protocol logic that clearly belongs to the service handler layer. Please review the changes in revision 531281 and if they are okay with you I'll close the issue. Anyways, this is a pretty major contribution. Many thanks for sending the patch Oleg > 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 > Affects Versions: 4.0-alpha4 > Reporter: Steffen Pingel > Assigned To: Oleg Kalnichevski > Fix For: 4.0-alpha5 > > 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: httpcomponents-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org