Annotation of libwww/Library/src/HTProxy.html, revision 2.4
2.1 frystyk 1: <HTML>
2: <HEAD>
3: <TITLE>Proxy and gateway Manager</TITLE>
4: </HEAD>
5: <BODY>
6:
7: <H1>Proxy and gateway Manager</H1>
8:
9: <PRE>
10: /*
11: ** (c) COPYRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
15:
16: This module keeps a list of proxies and gateways to be contacted on a
17: request in stead of requesting it directly from the origin server. The
18: module replaces the old system of environment variables for gateways
19: and proxies. However for backward compatibility there is a function
20: that reads the environment variables at start up. Note that there is a
21: difference between a proxy and a gateway - the difference is the way
22: the URL is set up in the <EM>RequestLine</EM> of the HTTP request. If
23: the original, full URL looks like
24: <CODE>"http://www.w3.org/test.html"</CODE> then the result will for a
25: proxy is <CODE>"http://www.w3.org/test.html"</CODE> and a gateway
26: <CODE>"/www.w3.org/test.html"</CODE> <P>
27:
28: The module is implemented by <A HREF="HTProxy.c">HTProxy.c</A>, and it
29: is a part of the <A NAME="z10"
2.3 frystyk 30: HREF="http://www.w3.org/pub/WWW/Library/">
2.2 frystyk 31: W3C 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>
49: extern BOOL HTProxy_setProxy PARAMS((CONST char *access,CONST char *proxy));
50: extern BOOL HTProxy_deleteProxy NOPARAMS;
51: </PRE>
52:
53: The remove function removes all registered proxies. This is
54: automatically done in <A
2.4 ! frystyk 55: HREF="HTReq.html#Library">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>
69: extern BOOL HTProxy_setNoProxy PARAMS((CONST char *host, CONST char *access,
70: unsigned port));
71: extern BOOL HTProxy_deleteNoProxy NOPARAMS;
72: </PRE>
73:
74: The remove function removes all entries in the list. This is
75: automatically done in <A
2.4 ! frystyk 76: HREF="HTReq.html#Library">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>
86: extern char * HTProxy_getProxy PARAMS((CONST char * url));
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>
98: extern BOOL HTProxy_setGateway PARAMS((CONST char *access, CONST char *gate));
99: extern BOOL HTProxy_deleteGateway NOPARAMS;
100: </PRE>
101:
102: The remove function removes all registered proxies. This is
103: automatically done in <A
2.4 ! frystyk 104: HREF="HTReq.html#Library">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>
113: extern char * HTProxy_getGateway PARAMS((CONST char * url));
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>
123: extern void HTProxy_getEnvVar NOPARAMS;
124: </PRE>
125:
126: <PRE>
127: #endif /* HTPROXY_H */
128: </PRE>
129:
130: End of HTProxy declaration
131:
132: </BODY>
133: </HTML>
Webmaster