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