Re: Adding an header to the request

At 20:36 2/6/98 -0500, James Gallagher wrote:

>I'm trying to add a `Accept-Encoding: gzip' header to the HTTP request issued
>by my client. When I use HTHeader_addGenerator(); the client hangs. 
>
>Version: libwww 5.1g compiled with gcc 2.8
>CPU/OS: SparcStation 5, Solaris 2.5.1
>Server: Apache 1.2.0

gzip is a content encoding which you normally register as a stream
converter just as any other content coding converter (deflate, for
example), content type (text/html for example), or transfer encoding
(deflate, for example).

In HTMIME.c, you can see how the input stream is built dynamically in
pumpData(...) when we have received a response and is parsing it.

You can see how the existing converters are registered in HTInit.c using
the following functions:

	Content Type converters: HTFormatInit(...)
	Content Coders: HTContentEncoderInit(...)
	Transfer Coders: HTTransferEncoderInit(...)

They are called from the "profiles" in HTProfil.c which are suited to
different types of applications (browsers, robots, etc.).

You can either register a stream converter on a pr request basis using the
functions described in

	http://www.w3.org/Library/src/HTReq.html#Accept

or you can add it for all requests by using the functions described in

	http://www.w3.org/Library/src/HTFormat.html#Global

So, if you want to register your gzip coder stream for all requests, you
would call

	HTFormat_addCoding ("gzip", gzipstream, gunzipstream, 1.0);

where the gzipstream and gunzipstream are streams very much like the
defalte stream that you can find in

	http://www.w3.org/Library/src/HTZip.c

although here you will only find the encoder stream.

The basic header add interface in 

	http://www.w3.org/Library/src/HTHeader.html
	
is more for headers that don't have any special meaning for libwww.

Hope this helps,

Henrik
--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk

Received on Saturday, 7 February 1998 14:05:42 UTC