version 2.10, 1996/04/12 17:48:32
|
version 2.11, 1996/08/08 02:16:56
|
Line 22
|
Line 22
|
|
|
/* Library include files */ |
/* Library include files */ |
#include "sysdep.h" |
#include "sysdep.h" |
#include "HTUtils.h" |
#include "WWWUtil.h" |
#include "HTString.h" |
#include "WWWCore.h" |
#include "HTList.h" |
#include "WWWHTTP.h" |
#include "HTParse.h" |
|
#include "HTWWWStr.h" |
|
#include "HTProxy.h" /* Implemented here */ |
#include "HTProxy.h" /* Implemented here */ |
|
|
/* Variables and typedefs local to this module */ |
/* Variables and typedefs local to this module */ |
Line 167 PRIVATE BOOL remove_AllHostnames (HTList
|
Line 165 PRIVATE BOOL remove_AllHostnames (HTList
|
*/ |
*/ |
PUBLIC BOOL HTProxy_add (const char * access, const char * proxy) |
PUBLIC BOOL HTProxy_add (const char * access, const char * proxy) |
{ |
{ |
if (!proxies) |
/* |
proxies = HTList_new(); |
** If this is the first time here then also add a before filter to handle |
|
** proxy authentication. This filter will be removed if we remove all |
|
** proxies again |
|
*/ |
|
if (!proxies) { |
|
proxies = HTList_new(); |
|
HTNetCall_addBefore(HTAA_proxyBeforeFilter, NULL, 0); |
|
} |
return add_object(proxies, access, proxy); |
return add_object(proxies, access, proxy); |
} |
} |
|
|
Line 179 PUBLIC BOOL HTProxy_deleteAll (void)
|
Line 184 PUBLIC BOOL HTProxy_deleteAll (void)
|
{ |
{ |
if (remove_allObjects(proxies)) { |
if (remove_allObjects(proxies)) { |
HTList_delete(proxies); |
HTList_delete(proxies); |
|
|
|
/* |
|
** If we have no more proxies then there is no reason for checking |
|
** proxy authentication. We therefore unregister the filter |
|
*/ |
|
HTNetCall_deleteBefore(HTAA_proxyBeforeFilter); |
|
|
proxies = NULL; |
proxies = NULL; |
return YES; |
return YES; |
} |
} |
Line 364 PUBLIC void HTProxy_getEnvVar (void)
|
Line 376 PUBLIC void HTProxy_getEnvVar (void)
|
NULL |
NULL |
}; |
}; |
const char **access = accesslist; |
const char **access = accesslist; |
|
if (PROT_TRACE)HTTrace("Proxy....... Looking for environment variables\n"); |
while (*access) { |
while (*access) { |
|
BOOL found = NO; |
char *gateway=NULL; |
char *gateway=NULL; |
char *proxy=NULL; |
char *proxy=NULL; |
|
|
/* search for proxy gateways */ |
/* Search for proxy gateways */ |
strcpy(buf, *access); |
if (found == NO) { |
strcat(buf, "_proxy"); |
strcpy(buf, *access); |
if ((proxy = (char *) getenv(buf)) && *proxy) |
strcat(buf, "_proxy"); |
HTProxy_add(*access, proxy); |
if ((proxy = (char *) getenv(buf)) && *proxy) { |
|
HTProxy_add(*access, proxy); |
/* search for gateway servers */ |
found = YES; |
strcpy(buf, "WWW_"); |
} |
strcat(buf, *access); |
|
strcat(buf, "_GATEWAY"); |
/* Try the same with upper case */ |
if ((gateway = (char *) getenv(buf)) && *gateway) |
if (found == NO) { |
HTGateway_add(*access, gateway); |
char * up = buf; |
|
while ((*up = TOUPPER(*up))) up++; |
|
if ((proxy = (char *) getenv(buf)) && *proxy) { |
|
HTProxy_add(*access, proxy); |
|
found = YES; |
|
} |
|
} |
|
} |
|
|
|
/* As a last resort, search for gateway servers */ |
|
if (found == NO) { |
|
strcpy(buf, "WWW_"); |
|
strcat(buf, *access); |
|
strcat(buf, "_GATEWAY"); |
|
if ((gateway = (char *) getenv(buf)) && *gateway) { |
|
HTGateway_add(*access, gateway); |
|
found = YES; |
|
} |
|
} |
++access; |
++access; |
} |
} |
|
|