[Prev][Next][Index][Thread]

Re: METHOD_HEAD bug



> We are updating our code to use the WWWLib 3.1 from WWWLib 3.0.  In 3.0 we
> found that to get METHOD_HEAD to work we needed to set the HTImProxy global
> variable to YES to keep the MIME parser from eating the header information.
> With the WWWLib 3.1 we found that this no longer works, here's why and how
> we fixed it.
> 
> Our goal is simple, use the WWWLib to get HTTP headers and pages off the net
> and into a local file.  We created our own HTStreamClass and provide an
> instance of it to request->output_stream.  The problem is the following code
> in HTTP.c:HTLoadHTTP:case HTTP_NEED_CONNECTION

This sould be a simple task. All you have to set in the request structure is 
the following:

	request->method = METHOD_HEAD;
	request->output_format = WWW_MIME;

WWW_MIME doesn't really make sense - it's just an internal repressentation 
meaning that the MIME headers should be kept. You can see an example in Line 
Mode Browser using:

	www -head -o <local.file> http://www.w3.org

if you want the whole content plus MIME headers then use

	www -to www/mime -o <local.file> http://www.w3.org

(the code can be found in HTBrowse.c in the LineMode/Implementation directory)

-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA