Re: Rule File (Using a Proxy server)

Roy Leonard writes:
> 
> 
> I am puzzled,  I have read through the manual for the Library and the ComLine
  
> 'browser' and have seen many references to rule files. Does anybody have a
> sample rule file?  Or know where I can find one?
> 
> I hope to use the rule file to et ComLine to use a proxy server.  If a rule
> file is not the appropriate way to do this, are there any suggestions about
> a better way to do this?

You can register proxies and gateways in two ways:

1) Use a rule file as you mention. You can find the syntax of rule files in 
the library documentation at

	http://www.w3.org/pub/WWW/Library/User/Using/RuleSyntax.html

2) You can set it up calling the proxy API described at

The rule file parser is part of the Rule file interface as described in the 
libwww guide. It is a stream which can be registered as a converter - just 
like any other stream converter. The library defines a default "mime" type 
for www rule files called WWW_RULES (it'sdefined in HTFormat.html). 

	http://www.w3.org/pub/WWW/Library/User/Using/

Note, that the rule file interface is _not_ part of the core libwww. Rule 
file mapping can be registered as a BEFORE callback function in the HTNet 
module.

In summary - what you have to do is:

	1) Register the rule file parser with the rule file MIME type as a stream
	   converter. You can do this by using the default stream converter
	   initialization function HTConverterInit() in the WWWInit interface.

	2) Register a rule file matching algorithm as a BEFORE call-out function.
	   libwww provides a default BEFORE call-out function which checks for
	   rule files and some other stuff. This can be set up by calling the
	   default BEFORE and AFTER initialization function HTNetInit(). This is
	   also defined in the WWWInit interface.

This is a very typical way of handling registration in libwww. All actions 
that you want to perform on a request can be registerd as BEFORE or AFTER 
call-out function in the Net Manager. The list of BEFORE or AFTER call-out 
functions can either be global to _all_ requests or _local_ to a single 
request. In the latter case you assign a list of call-out functions directly 
to the request object in HTReq.html

Registering streams (or converters) is also a very normal action. It 
basically tells the library that when you see a certain media type you 
should call this stream to do the data processing.

The initialization interface (WWWInit.html) contains a lot of default 
initialization functions that sets of all the features of libwww. This is 
not required to use by the application but it often makes life easier. It's 
basically the principle that I have tried to get across - libwww core 
doesn't do anything - it's a registry. By registering features the libwww 
takes the profile that you want your application to have - it can be server 
side features or client side featurs - you name it.


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

Received on Monday, 24 June 1996 13:06:06 UTC