version 1.175, 1999/03/04 17:26:10
|
version 1.176, 1999/03/09 18:11:33
|
Line 25
|
Line 25
|
#define AMAYA_LOST_UPDATE |
#define AMAYA_LOST_UPDATE |
|
|
#define CACHE_DIR_NAME DIR_STR"libwww-cache" |
#define CACHE_DIR_NAME DIR_STR"libwww-cache" |
#define DEFAULT_CACHE_SIZE 5 |
#define DEFAULT_CACHE_SIZE 10 |
|
#define DEFAULT_MAX_CACHE_ENTRY_SIZE 3 |
#define DEFAULT_MAX_SOCKET 64 |
#define DEFAULT_MAX_SOCKET 64 |
#define DEFAULT_DNS_TIMEOUT 60 |
#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 825 int status;
|
Line 826 int status;
|
/* |
/* |
** reset the Amaya and libwww request status |
** reset the Amaya and libwww request status |
*/ |
*/ |
/* clear the errors */ |
|
HTError_deleteAll (HTRequest_error (request)); |
/* start with a new, clean request structure */ |
HTRequest_setError (request, NULL); |
HTRequest_delete (me->request); |
/* clear the authentication credentials */ |
me->request = HTRequest_new (); |
HTRequest_deleteCredentialsAll (request); |
/* clean the associated file structure) */ |
/* the method has to be GET in order to download the source file */ |
HTRequest_setOutputStream (me->request, NULL); |
|
/* Initialize the other members of the structure */ |
HTRequest_setMethod (me->request, METHOD_GET); |
HTRequest_setMethod (me->request, METHOD_GET); |
|
HTRequest_setOutputFormat (me->request, WWW_SOURCE); |
|
HTRequest_setContext (me->request, me); |
|
HTRequest_setPreemptive (me->request, NO); |
|
/* |
|
** Make sure that the first request is flushed immediately and not |
|
** buffered in the output buffer |
|
*/ |
|
if (me->mode & AMAYA_FLUSH_REQUEST) |
|
HTRequest_setFlush(me->request, YES); |
|
|
/* turn off preconditions */ |
/* turn off preconditions */ |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
me->reqStatus = HT_NEW; |
me->reqStatus = HT_NEW; |
/* make the request */ |
/* make the request */ |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), me->dest, me->request); |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), |
|
me->dest, me->request); |
/* stop here */ |
/* stop here */ |
return HT_ERROR; |
return HT_ERROR; |
} |
} |
Line 889 static int check_handler (HTRequest * re
|
Line 902 static int check_handler (HTRequest * re
|
} |
} |
else if ( (abs(status)/100) != 2) |
else if ( (abs(status)/100) != 2) |
{ |
{ |
/* it's a new ressource, so we start a new PUT request with a |
/* start with a new, clean request structure */ |
"if-none-match *" precondition */ |
HTRequest_delete (me->request); |
/* clear the errors */ |
me->request = HTRequest_new (); |
HTError_deleteAll (HTRequest_error (request)); |
/* clean the associated file structure) */ |
HTRequest_setError (request, NULL); |
HTRequest_setOutputStream (me->request, NULL); |
/* clear the authentication credentials */ |
/* Initialize the other members of the structure */ |
HTRequest_deleteCredentialsAll (request); |
|
/* the method has to be GET in order to download the source file */ |
|
HTRequest_setMethod (me->request, METHOD_GET); |
HTRequest_setMethod (me->request, METHOD_GET); |
|
HTRequest_setOutputFormat (me->request, WWW_SOURCE); |
|
HTRequest_setContext (me->request, me); |
|
HTRequest_setPreemptive (me->request, NO); |
|
/* |
|
** Make sure that the first request is flushed immediately and not |
|
** buffered in the output buffer |
|
*/ |
|
if (me->mode & AMAYA_FLUSH_REQUEST) |
|
HTRequest_setFlush(me->request, YES); |
|
|
|
/* turn on the special preconditions, to avoid having this |
|
ressource appear before we do the PUT */ |
HTRequest_setPreconditions(me->request, HT_DONT_MATCH_ANY); |
HTRequest_setPreconditions(me->request, HT_DONT_MATCH_ANY); |
me->reqStatus = HT_NEW; |
me->reqStatus = HT_NEW; |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), me->dest, me->request); |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), me->dest, me->request); |
return HT_ERROR; /* stop here */ |
return HT_ERROR; /* stop here */ |
} |
} |
else |
else |
{ |
{ |
if (prompt) |
if (prompt) |
Line 914 static int check_handler (HTRequest * re
|
Line 937 static int check_handler (HTRequest * re
|
if (force_put) |
if (force_put) |
{ |
{ |
/* Start a new PUT request without preconditions */ |
/* Start a new PUT request without preconditions */ |
/* clear the errors */ |
|
HTError_deleteAll (HTRequest_error (request)); |
/* get a new, clean request structure */ |
HTRequest_setError (request, NULL); |
HTRequest_delete (me->request); |
/* clear the authentication credentials */ |
me->request = HTRequest_new (); |
HTRequest_deleteCredentialsAll (request); |
/* clean the associated file structure) */ |
/* the method has to be GET in order to download the source file */ |
HTRequest_setOutputStream (me->request, NULL); |
|
/* Initialize the other members of the structure */ |
HTRequest_setMethod (me->request, METHOD_GET); |
HTRequest_setMethod (me->request, METHOD_GET); |
/* Start a new PUT request without preconditions */ |
HTRequest_setOutputFormat (me->request, WWW_SOURCE); |
|
HTRequest_setContext (me->request, me); |
|
HTRequest_setPreemptive (me->request, NO); |
|
/* |
|
** Make sure that the first request is flushed immediately and not |
|
** buffered in the output buffer |
|
*/ |
|
if (me->mode & AMAYA_FLUSH_REQUEST) |
|
HTRequest_setFlush(me->request, YES); |
|
/* remove the preconditions */ |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
me->reqStatus = HT_NEW; |
me->reqStatus = HT_NEW; |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), me->dest, me->request); |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), |
|
me->dest, me->request); |
return HT_ERROR; /* stop here */ |
return HT_ERROR; /* stop here */ |
} |
} |
else |
else |
Line 1050 int status;
|
Line 1084 int status;
|
/* copy the content_type */ |
/* copy the content_type */ |
if (!me->content_type) |
if (!me->content_type) |
{ |
{ |
/* @@ should get this info from response */ |
if (response && HTResponse_format (response)) |
if (request->anchor && request->anchor->content_type) |
content_type = HTAtom_name (HTResponse_format (response)); |
content_type = request->anchor->content_type->name; |
|
else |
else |
content_type = "www/unknown"; |
content_type = "www/unknown"; |
|
|
Line 1224 HTList *c;
|
Line 1257 HTList *c;
|
/* Define here the equivalences between MIME types and file extensions for |
/* Define here the equivalences between MIME types and file extensions for |
the types that Amaya can display */ |
the types that Amaya can display */ |
|
|
|
/* Initialize suffix bindings for local files */ |
|
HTBind_init(); |
|
|
/* Register the default set of file suffix bindings */ |
/* Register the default set of file suffix bindings */ |
HTFileInit (); |
HTFileInit (); |
|
|
Line 1559 View view;
|
Line 1595 View view;
|
{ |
{ |
/* @@@ we couldn't open the directory ... we need some msg */ |
/* @@@ we couldn't open the directory ... we need some msg */ |
perror (dirname); |
perror (dirname); |
exit; |
return; |
} |
} |
|
|
while ((d = readdir (dp)) != NULL) |
while ((d = readdir (dp)) != NULL) |
Line 1619 static void Cacheinit ()
|
Line 1655 static void Cacheinit ()
|
char *cache_dir = NULL; |
char *cache_dir = NULL; |
char *cache_lockfile; |
char *cache_lockfile; |
int cache_size; |
int cache_size; |
|
int cache_entry_size; |
boolean cache_enabled; |
boolean cache_enabled; |
boolean cache_locked; |
boolean cache_locked; |
|
|
Line 1658 static void Cacheinit ()
|
Line 1695 static void Cacheinit ()
|
else |
else |
cache_size = DEFAULT_CACHE_SIZE; |
cache_size = DEFAULT_CACHE_SIZE; |
|
|
|
/* get the max cached file size (or use a default one) */ |
|
if (!TtaGetEnvInt ("MAX_CACHE_ENTRY_SIZE", &cache_entry_size)) |
|
cache_entry_size = DEFAULT_MAX_CACHE_ENTRY_SIZE; |
|
|
if (cache_enabled) |
if (cache_enabled) |
{ |
{ |
/* how to remove the lock? force remove it? */ |
/* how to remove the lock? force remove it? */ |
Line 1685 static void Cacheinit ()
|
Line 1726 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); |
HTCacheInit (cache_dir, cache_size); |
|
HTCacheMode_setMaxCacheEntrySize (cache_entry_size); |
HTCacheMode_setExpires (HT_EXPIRES_AUTO); |
HTCacheMode_setExpires (HT_EXPIRES_AUTO); |
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 |
Line 1935 void QueryInit ()
|
Line 1977 void QueryInit ()
|
HTTimer_registerDeleteTimerCallback ((void *) AMAYA_DeleteTimer); |
HTTimer_registerDeleteTimerCallback ((void *) AMAYA_DeleteTimer); |
#endif /* !_WINDOWS */ |
#endif /* !_WINDOWS */ |
|
|
WWW_TraceFlag = CACHE_TRACE; |
WWW_TraceFlag = 0; |
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
/* forwards error messages to our own function */ |
/* forwards error messages to our own function */ |
WWW_TraceFlag = THD_TRACE; |
WWW_TraceFlag = THD_TRACE; |
Line 2938 boolean value;
|
Line 2980 boolean value;
|
CanDoStop_flag = value; |
CanDoStop_flag = value; |
} |
} |
|
|
|
#ifdef __STDC__ |
|
void libwww_updateNetworkConf (int status) |
|
#else |
|
void libwww_updateNetworkConf (status) |
|
int status; |
|
#endif /*__STDC__*/ |
|
{ |
|
/* @@@ the docid parameter isn't used... clean it up */ |
|
int docid = 1; |
|
|
|
/* first, stop all current requests, as the network |
|
may make some changes */ |
|
StopAllRequests (docid); |
|
|
|
if (status & AMAYA_PROXY_RESTART) |
|
{ |
|
HTProxy_deleteAll (); |
|
ProxyInit (); |
|
} |
|
|
|
if (status & AMAYA_CACHE_RESTART) |
|
{ |
|
clear_cachelock (); |
|
HTCacheTerminate (); |
|
HTCacheMode_setEnabled (NO); |
|
CacheInit (); |
|
} |
|
} |
|
|
#endif /* AMAYA_JAVA */ |
#endif /* AMAYA_JAVA */ |
|
|
/* |
/* |