Annotation of libwww/Library/src/HTProxy.html, revision 2.12
2.1 frystyk 1: <HTML>
2: <HEAD>
2.10 frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.11 frystyk 4: <TITLE>W3C Sample Code Library libwww Proxies and Gateways</TITLE>
2.1 frystyk 5: </HEAD>
6: <BODY>
2.10 frystyk 7: <H1>
8: Proxy and gateway Manager
9: </H1>
2.1 frystyk 10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.10 frystyk 16: <P>
17: This module keeps a list of proxies and gateways to be contacted on a request
18: in stead of requesting it directly from the origin server. The module replaces
19: the old system of environment variables for gateways and proxies. However
20: for backward compatibility there is a function that reads the environment
21: variables at start up. Note that there is a difference between a proxy and
22: a gateway - the difference is the way the URL is set up in the
23: <EM>RequestLine</EM> of the HTTP request. If the original, full URL looks
24: like <CODE>"http://www.w3.org/test.html"</CODE> then the result will for
25: a proxy is <CODE>"http://www.w3.org/test.html"</CODE> and a gateway
26: <CODE>"/www.w3.org/test.html"</CODE>
27: <P>
28: The module is implemented by <A HREF="HTProxy.c">HTProxy.c</A>, and it is
2.12 ! frystyk 29: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.10 frystyk 30: Library</A>.
31: <PRE>#ifndef HTPROXY_H
2.1 frystyk 32: #define HTPROXY_H
33:
34: #include "HTList.h"
35: </PRE>
2.10 frystyk 36: <H2>
37: Registering a proxy server
38: </H2>
39: <P>
40: A proxy server is registered with a corresponding access method, for example
41: <EM>http</EM>, <EM>ftp</EM> etc. The `proxy' parameter should be a fully
42: valid name, like <CODE>http://proxy.w3.org:8001</CODE> but domain name is
43: not required. If an entry exists for this access then delete it and use the
44: new one.
2.1 frystyk 45: <PRE>
2.6 frystyk 46: extern BOOL HTProxy_add (const char * access, const char * proxy);
2.5 frystyk 47: extern BOOL HTProxy_deleteAll (void);
2.1 frystyk 48: </PRE>
2.10 frystyk 49: <P>
50: The remove function removes all registered proxies. This is automatically
51: done in <A HREF="HTLib.html"> HTLibTerminate()</A> <A NAME="noproxy"></A>
52: <H2>
53: Registering a host or domain with no proxy
54: </H2>
55: <P>
56: The <EM>noproxy</EM> list is a list of host names and domain names where
57: we don't contact a proxy even though a proxy is in fact registered for this
58: particular access method . When registering a <EM>noproxy</EM> item, you
59: can specify a specific port for this access method in which case it isvalid
60: only for requests to this port. If `port' is '0' then it applies to all ports
61: and if `access' is NULL then it applies to to all access methods. Examples
62: of host names are <CODE>w3.org</CODE> and <CODE>www.close.com</CODE>
2.1 frystyk 63: <PRE>
2.6 frystyk 64: extern BOOL HTNoProxy_add (const char * host, const char * access,
2.5 frystyk 65: unsigned port);
66: extern BOOL HTNoProxy_deleteAll (void);
2.1 frystyk 67: </PRE>
2.10 frystyk 68: <P>
69: The remove function removes all entries in the list. This is automatically
70: done in <A HREF="HTLib.html"> HTLibTerminate()</A>
71: <H2>
72: Look for a Proxy server
73: </H2>
74: <P>
75: This function evaluates the lists of registered proxies and if one is found
76: for the actual access method and it is not registered in the `noproxy' list,
77: then a URL containing the host to be contacted is returned to the caller.
78: This string must be freed be the caller.
2.1 frystyk 79: <PRE>
2.6 frystyk 80: extern char * HTProxy_find (const char * url);
2.1 frystyk 81: </PRE>
2.10 frystyk 82: <H2>
83: Registering a gateway
84: </H2>
85: <P>
86: A gateway is registered with a corresponding access method, for example
87: <EM>http</EM>, <EM>ftp</EM> etc. The `gate' parameter should be a fully valid
88: name, like <CODE>http://gateway.w3.org:8001</CODE> but domain name is not
89: required. If an entry exists for this access then delete it and use the new
90: one.
2.1 frystyk 91: <PRE>
2.6 frystyk 92: extern BOOL HTGateway_add (const char * access, const char * gate);
2.5 frystyk 93: extern BOOL HTGateway_deleteAll (void);
2.1 frystyk 94: </PRE>
2.10 frystyk 95: <P>
96: The remove function removes all registered proxies. This is automatically
97: done in <A HREF="HTLib.html"> HTLibTerminate()</A>
98: <H2>
99: Look for a Gateway
100: </H2>
101: <P>
102: This function evaluates the lists of registered gateways and if one is found
103: for the actual access method then it is returned and must be freed by the
104: caller.
2.1 frystyk 105: <PRE>
2.6 frystyk 106: extern char * HTGateway_find (const char * url);
2.1 frystyk 107: </PRE>
2.10 frystyk 108: <H2>
109: Backwards Compability with Environment Variables
110: </H2>
111: <P>
112: This function maintains backwards compatibility with the old environment
113: variables and searches for the most common values: http, ftp, news, wais,
114: and gopher
2.1 frystyk 115: <PRE>
2.5 frystyk 116: extern void HTProxy_getEnvVar (void);
2.1 frystyk 117: </PRE>
118: <PRE>
119: #endif /* HTPROXY_H */
120: </PRE>
2.10 frystyk 121: <P>
122: <HR>
2.8 frystyk 123: <ADDRESS>
2.12 ! frystyk 124: @(#) $Id: HTProxy.html,v 2.11 1997/02/16 18:42:51 frystyk Exp $
2.8 frystyk 125: </ADDRESS>
2.10 frystyk 126: </BODY></HTML>
Webmaster