version 1.176, 1999/03/09 18:11:33
|
version 1.177, 1999/03/12 03:01:04
|
Line 27
|
Line 27
|
#define CACHE_DIR_NAME DIR_STR"libwww-cache" |
#define CACHE_DIR_NAME DIR_STR"libwww-cache" |
#define DEFAULT_CACHE_SIZE 10 |
#define DEFAULT_CACHE_SIZE 10 |
#define DEFAULT_MAX_CACHE_ENTRY_SIZE 3 |
#define DEFAULT_MAX_CACHE_ENTRY_SIZE 3 |
#define DEFAULT_MAX_SOCKET 64 |
#define DEFAULT_MAX_SOCKET 32 |
#define DEFAULT_DNS_TIMEOUT 1800L |
#define DEFAULT_DNS_TIMEOUT 1800L |
#define DEFAULT_PERSIST_TIMEOUT 60L |
#define DEFAULT_PERSIST_TIMEOUT 60L |
#define DEFAULT_NET_EVENT_TIMEOUT 60000 |
#define DEFAULT_NET_EVENT_TIMEOUT 60000 |
Line 1470 View view;
|
Line 1470 View view;
|
char *strptr; |
char *strptr; |
char *cache_dir; |
char *cache_dir; |
int cache_size; |
int cache_size; |
|
int cache_expire; |
|
int cache_disconnect; |
|
|
if (!HTCacheMode_enabled ()) |
if (!HTCacheMode_enabled ()) |
/* don't do anything if we're not using a cache */ |
/* don't do anything if we're not using a cache */ |
Line 1477 View view;
|
Line 1479 View view;
|
/* temporarily close down the cache, purge it, then restart */ |
/* temporarily close down the cache, purge it, then restart */ |
cache_dir = TtaStrdup ( (char *) HTCacheMode_getRoot ()); |
cache_dir = TtaStrdup ( (char *) HTCacheMode_getRoot ()); |
cache_size = HTCacheMode_maxSize (); |
cache_size = HTCacheMode_maxSize (); |
|
cache_expire = HTCacheMode_expires (); |
|
cache_disconnect = HTCacheMode_disconnected (); |
|
|
/* remove the concurrent cache lock */ |
/* remove the concurrent cache lock */ |
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
fprintf (stderr, "Clearing the cache lock\n"); |
fprintf (stderr, "Clearing the cache lock\n"); |
Line 1490 View view;
|
Line 1495 View view;
|
|
|
RecCleanCache (strptr); |
RecCleanCache (strptr); |
|
|
HTCacheMode_setExpires (HT_EXPIRES_AUTO); |
HTCacheMode_setExpires (cache_expire); |
|
HTCacheMode_setDisconnected (cache_disconnect); |
HTCacheInit (cache_dir, cache_size); |
HTCacheInit (cache_dir, cache_size); |
/* set a new concurrent cache lock */ |
/* set a new concurrent cache lock */ |
strcat (strptr, ".lock"); |
strcat (strptr, ".lock"); |
Line 1658 static void Cacheinit ()
|
Line 1664 static void Cacheinit ()
|
int cache_entry_size; |
int cache_entry_size; |
boolean cache_enabled; |
boolean cache_enabled; |
boolean cache_locked; |
boolean cache_locked; |
|
boolean tmp_bool; |
|
|
/* activate cache? */ |
/* activate cache? */ |
strptr = (char *) TtaGetEnvString ("ENABLE_CACHE"); |
strptr = (char *) TtaGetEnvString ("ENABLE_CACHE"); |
Line 1725 static void Cacheinit ()
|
Line 1732 static void Cacheinit ()
|
{ |
{ |
/* initialize the cache if there's no other amaya |
/* initialize the cache if there's no other amaya |
instance running */ |
instance running */ |
HTCacheInit (cache_dir, cache_size); |
|
HTCacheMode_setMaxCacheEntrySize (cache_entry_size); |
HTCacheMode_setMaxCacheEntrySize (cache_entry_size); |
HTCacheMode_setExpires (HT_EXPIRES_AUTO); |
if (TtaGetEnvBoolean ("CACHE_EXPIRE_IGNORE", &tmp_bool) |
|
&& tmp_bool) |
|
HTCacheMode_setExpires (HT_EXPIRES_IGNORE); |
|
else |
|
HTCacheMode_setExpires (HT_EXPIRES_AUTO); |
|
TtaGetEnvBoolean ("CACHE_DISCONNECTED_MODE", &tmp_bool); |
|
if (tmp_bool) |
|
HTCacheMode_setDisconnected (HT_DISCONNECT_NORMAL); |
|
else |
|
HTCacheMode_setDisconnected (HT_DISCONNECT_NONE); |
|
HTCacheInit (cache_dir, cache_size); |
if (set_cachelock (cache_lockfile) == -1) |
if (set_cachelock (cache_lockfile) == -1) |
/* couldn't open the .lock file, so, we close the cache to |
/* couldn't open the .lock file, so, we close the cache to |
be in the safe side */ |
be in the safe side */ |
Line 2333 char *content_type;
|
Line 2349 char *content_type;
|
char *ref; |
char *ref; |
int status, l; |
int status, l; |
int tempsubdir; |
int tempsubdir; |
|
boolean bool_tmp; |
|
|
if (urlName == NULL || docid == 0 || outputfile == NULL) |
if (urlName == NULL || docid == 0 || outputfile == NULL) |
{ |
{ |
Line 2500 char *content_type;
|
Line 2517 char *content_type;
|
|
|
me->anchor = (HTParentAnchor *) HTAnchor_findAddress (ref); |
me->anchor = (HTParentAnchor *) HTAnchor_findAddress (ref); |
TtaFreeMemory (ref); |
TtaFreeMemory (ref); |
|
|
if (mode & AMAYA_NOCACHE) |
TtaGetEnvBoolean ("CACHE_DISCONNECTED_MODE", &bool_tmp); |
|
if (!bool_tmp && (mode & AMAYA_NOCACHE)) |
HTRequest_setReloadMode (me->request, HT_CACHE_FLUSH); |
HTRequest_setReloadMode (me->request, HT_CACHE_FLUSH); |
|
|
/* prepare the query string and format for POST */ |
/* prepare the query string and format for POST */ |