W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1998

Re: Adding an header to the request

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Sat, 07 Feb 1998 14:05:19 -0500
Message-Id: <>
To: James Gallagher <jimg@dcz.cvo.oneworld.com>, www-lib@w3.org
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


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


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


although here you will only find the encoder stream.

The basic header add interface in 

is more for headers that don't have any special meaning for libwww.

Hope this helps,

Henrik Frystyk Nielsen,
World Wide Web Consortium
Received on Saturday, 7 February 1998 14:05:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:47 UTC