📄 htproxy.h
字号:
/* W3C Sample Code Library libwww Proxies and Gateways! Proxy and gateway Manager!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*This module keeps a list of proxies and gateways to be contacted on a requestin stead of requesting it directly from the origin server. The module replacesthe old system of environment variables for gateways and proxies. Howeverfor backward compatibility there is a function that reads the environmentvariables at start up. Note that there is a difference between a proxy anda gateway - the difference is the way the URL is set up in theRequestLine of the HTTP request. If the original, full URL lookslike "http://www.w3.org/test.html" then the result will fora proxy is "http://www.w3.org/test.html" and a gateway"/www.w3.org/test.html"The module is implemented by HTProxy.c, and it isa part of the W3C Sample CodeLibrary.*/#ifndef HTPROXY_H#define HTPROXY_H#include "HTList.h"/*. Registering a Proxy Server.A proxy server is registered with a corresponding access method, for examplehttp, ftp etc. The `proxy' parameter should be a fullyvalid name, like http://proxy.w3.org:8001 but domain name isnot required. If an entry exists for this access then delete it and use thenew one.*/extern BOOL HTProxy_add (const char * access, const char * proxy);/*( Registering a Proxy Using Regular Expressions)Registers a proxy as the server to contact for any URL matching the regularexpression. This requires that you have compiled with theHT_POSIX_REGEX flag, see the installationinstructions. If you call this function without having compiled withthe HT_POSIX_REGEX flag then you will essentially get the non-regexversion. The name of the proxy should be a fully valid URL, like"http://proxy.w3.org:8001". Returns YES if OK, else NO*/extern BOOL HTProxy_addRegex (const char * regex, const char * proxy, int regex_flags);/*( Deleting All Registered Proxies)*/extern BOOL HTProxy_deleteAll (void);/*The remove function removes all registered proxies. This is automaticallydone in HTLibTerminate() . Registering a No Proxy Location.The noproxy list is a list of host names and domain names wherewe don't contact a proxy even though a proxy is in fact registered for thisparticular access method . When registering a noproxy item, youcan specify a specific port for this access method in which case it isvalidonly for requests to this port. If `port' is '0' then it applies to all portsand if `access' is NULL then it applies to to all access methods. Examplesof host names are w3.org and www.close.com*/extern BOOL HTNoProxy_add (const char * host, const char * access, unsigned port);/*( Registering a NoProxy Location Using Regular Expressions)Registers a regular expression where URIs matching this expression shouldgo directly and not via a proxy. Examples:http://<star>\.w3\.org andhttp://www\.noproxy\.com/<star> (I use<star> in order not interfere with C comments) This requiresthat you have compiled with the HT_POSIX_REGEX flag, see theinstallation instructions. If you call thisfunction without having compiled with the HT_POSIX_REGEX flag thenyou will essentially get the non-regex version. */extern BOOL HTNoProxy_addRegex (const char * regex, int regex_flags);/*( Delete all Noproxy Destinations)*/extern BOOL HTNoProxy_deleteAll (void);/*The remove function removes all entries in the list. This is automaticallydone in HTLibTerminate()( Inverse the meaning of the NoProxy list)Allows to change the value of a flag so that the NoProxy list is interpretedas if it were an OnlyProxy list.*/extern int HTProxy_NoProxyIsOnlyProxy (void);extern void HTProxy_setNoProxyIsOnlyProxy (int value);/*. Look for a Proxy server.This function evaluates the lists of registered proxies and if one is foundfor the actual access method and it is not registered in the `noproxy' list,then a URL containing the host to be contacted is returned to the caller.This string must be freed be the caller.*/extern char * HTProxy_find (const char * url);/*. Registering a gateway.A gateway is registered with a corresponding access method, for examplehttp, ftp etc. The `gate' parameter should be a fully validname, like http://gateway.w3.org:8001 but domain name is notrequired. If an entry exists for this access then delete it and use the newone.*/extern BOOL HTGateway_add (const char * access, const char * gate);extern BOOL HTGateway_deleteAll (void);/*The remove function removes all registered proxies. This is automaticallydone in HTLibTerminate(). Look for a Gateway.This function evaluates the lists of registered gateways and if one is foundfor the actual access method then it is returned and must be freed by thecaller.*/extern char * HTGateway_find (const char * url);/*. Backwards Compability with Environment Variables.This function maintains backwards compatibility with the old environmentvariables and searches for the most common values: http, ftp, news, wais,and gopher*/extern void HTProxy_getEnvVar (void);/**/#endif /* HTPROXY_H *//* @(#) $Id: HTProxy.html,v 2.14 2000/02/29 14:25:59 kahan Exp $*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -