That would seem like the logical thing to do, d'oh!  I will see what I
can do to work that into my application.  I currently do special
processing of headers in my custom method so, short of just duplicating
HeadMethod in my code, the next best option for me was to make
HttpMethodBase smarter.

Tony

-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 4:19 AM
To: HttpClient User Discussion
Subject: Re: Handling HEAD method

On Tue, 2006-09-12 at 20:25 -0400, Tony Thompson wrote:
> I am still back on the 2.0.2 version of the client (I will get up to 3
> soon) but I am having an issue that I need to know how to best patch 
> for now and also to make sure it is not an issue in the 3.x code.  I 
> am using a method that does a HEAD request (derived from GetMethod).  
> The RFC states that the HEAD response MUST NOT include a response
body.

Question. Why are you not using HeadMethod that comes with HttpClient,
or at the very least do not derive your custom class from that method?

HeadMethod shipped with HttpClient correctly implements the requirements
of the HTTP spec with regards to HEAD request / response handling.

http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/htt
pclient/methods/HeadMethod.html#147

Oleg

>  The
> issue is, the Content-Length header is set so the HTTPClient thinks 
> there should be content coming.  So, it sits and waits for the server 
> to send content.  In the 2.0.2 client, a method was added to deal with

> various responses that should not have a response body, 
> canResponseHaveBody().  I think to patch this up for my situation, I 
> will fix readResponseBody() so that it also checks if the method is 
> HEAD and then assumes no body allowed.  I thought about fixing this in

> my derived class but, I don't really want to override all of 
> readResponse() just to get it to ignore HEAD responses.
> 
> If this makes sense to have in the HTTPClient code, can the 3.x code 
> be fixed so that it also enforces the requirement that a HEAD response

> will not have a body?
> 
> Thanks
> Tony
>  
> This message (and any associated files) is intended only for the use 
> of the individual or entity to which it is addressed and may contain 
> information that is confidential, subject to copyright or constitutes 
> a trade secret. If you are not the intended recipient you are hereby 
> notified that any dissemination, copying or distribution of this 
> message, or files associated with this message, is strictly 
> prohibited. If you have received this message in error, please notify 
> us immediately by replying to the message and deleting it from your 
> computer. Messages sent to and from Stoneware, Inc.
> may be monitored.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 
This message (and any associated files) is intended only for the 
use of the individual or entity to which it is addressed and may 
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient 
you are hereby notified that any dissemination, copying or 
distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, 
please notify us immediately by replying to the message and deleting 
it from your computer. Messages sent to and from Stoneware, Inc.
may be monitored.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to