📄 lib_5.0_1.fix
字号:
Index: Library/Repository/src/HTAnchor.cdiff -c Library/Repository/src/HTAnchor.c:1.61 Library/Repository/src/HTAnchor.c:1.62*** Library/Repository/src/HTAnchor.c:1.61 Mon Sep 9 20:54:28 1996--- Library/Repository/src/HTAnchor.c Thu Sep 12 22:05:20 1996****************** 3,9 **** ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** An anchor represents a region of a hypertext document which is ** linked to another anchor in the same or a different document.--- 3,9 ---- ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** An anchor represents a region of a hypertext document which is ** linked to another anchor in the same or a different document.****************** 1074,1079 ****--- 1074,1080 ---- #if 0 if (me->last_modified < 0) me->last_modified = me->date; #endif+ if (ANCH_TRACE) HTTrace("HTAnchor.... Anchor is parsed\n"); me->header_parsed = YES; } }****************** 1088,1093 ****--- 1089,1095 ---- */ PUBLIC void HTAnchor_clearHeader (HTParentAnchor * me) {+ if (ANCH_TRACE) HTTrace("HTAnchor.... Clearing header\n"); me->methods = METHOD_INVALID; if (me->content_encoding) { HTList_delete(me->content_encoding);****************** 1129,1143 **** HT_FREE(me->version); HT_FREE(me->etag); ! #if 0! if (me->extra_headers) {! HTList *cur = me->extra_headers;! char *pres;! while ((pres = (char *) HTList_nextObject(cur)))! HT_FREE(pres);! HTList_delete(me->extra_headers);! me->extra_headers = NULL;! }! me->header_parsed = NO; /* All cleared */! #endif }--- 1131,1136 ---- HT_FREE(me->version); HT_FREE(me->etag); ! /* Anchor is cleared */! me->header_parsed = NO; }Index: Library/Repository/src/HTCache.cdiff -c Library/Repository/src/HTCache.c:2.24 Library/Repository/src/HTCache.c:2.25*** Library/Repository/src/HTCache.c:2.24 Mon Sep 9 16:53:31 1996--- Library/Repository/src/HTCache.c Thu Sep 12 22:05:22 1996****************** 3,9 **** ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This modules manages the cache **--- 3,9 ---- ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This modules manages the cache ******************** 256,262 **** /* ** Walk through the list and write it out. The format is really! ** simple as we keep it all in ASCII */ { HTList * cur;--- 256,262 ---- /* ** Walk through the list and write it out. The format is really! ** simple as we keep it all in ASCII. */ { HTList * cur;****************** 333,338 ****--- 333,350 ---- cache->must_revalidate = validate-0x30; /*+ ** Create the new anchor and fill in the information that we have read+ ** in the index. This is for example the etag and date+ */+ if (cache) {+ HTAnchor * anchor = HTAnchor_findAddress(cache->url);+ HTParentAnchor * parent = HTAnchor_parent(anchor);+ HTAnchor_setDate(parent, cache->date);+ HTAnchor_setExpires(parent, cache->expires);+ if (cache->etag) HTAnchor_setEtag(parent, cache->etag);+ }+ + /* ** Create the cache table if not already existent and add the new ** entry. Also check that the hash is still within bounds */****************** 983,988 ****--- 995,1079 ---- } /*+ ** Is we have a valid entry in the cache then we also need a location+ ** where we can get it. Hopefully, we may be able to access it+ ** thourgh one of our protocol modules, for example the local file+ ** module. The name returned is in URL syntax and must be freed by+ ** the caller+ */+ PRIVATE char * HTCache_location (HTCache * cache, BOOL meta)+ {+ char * local = NULL;+ if (cache && HTCacheRoot) {+ if (meta) {+ if ((local = (char *) HT_MALLOC(strlen(HTCacheRoot) + 10 ++ strlen(HT_CACHE_META) ++ strlen(cache->cachename))) == NULL)+ HT_OUTOFMEM("HTCache_location");+ sprintf(local, "%s%d/%s%s", HTCacheRoot, cache->hash, cache->cachename,+ HT_CACHE_META);+ } else {+ if ((local = (char *) HT_MALLOC(strlen(HTCacheRoot) + 10 ++ strlen(cache->cachename))) == NULL)+ HT_OUTOFMEM("HTCache_location");+ sprintf(local, "%s%d/%s", HTCacheRoot, cache->hash, cache->cachename);+ }+ }+ return local;+ }+ + /*+ ** Remove from disk. You must explicitly remove a lock+ ** before this operation can succeed+ */+ PRIVATE BOOL flush_object (HTCache * cache)+ {+ if (cache && !HTCache_hasLock(cache)) {+ char * head = HTCache_location(cache, YES);+ char * body = HTCache_location(cache, NO);+ REMOVE(head);+ REMOVE(body);+ HT_FREE(head);+ HT_FREE(body);+ return YES;+ }+ return NO;+ }+ + /* HTCache_flushAll+ ** ----------------+ ** Destroys all cache entried in memory and on disk. Resets the cache+ ** to empty but the cache does not have to be reinitialized before we+ ** can use it again.+ */+ PUBLIC BOOL HTCache_flushAll (void)+ {+ if (CacheTable) {+ HTList * cur;+ int cnt;+ + /* Delete the rest */+ for (cnt=0; cnt<HASH_SIZE; cnt++) {+ if ((cur = CacheTable[cnt])) { + HTCache * pres;+ while ((pres = (HTCache *) HTList_nextObject(cur)) != NULL) {+ flush_object(pres);+ free_object(pres);+ }+ }+ HTList_delete(CacheTable[cnt]);+ CacheTable[cnt] = NULL;+ }+ + /* Write the new empty index to disk */+ HTCacheIndex_write(HTCacheRoot);+ HTTotalSize = 0L;+ return YES;+ }+ return NO;+ }+ + /* ** This function checks whether a document has expired or not. ** The check is based on the metainformation passed in the anchor object ** The function returns the level of validation needed for getting a fresh****************** 1096,1129 **** ** module. The name returned is in URL syntax and must be freed by ** the caller */- PRIVATE char * HTCache_location (HTCache * cache, BOOL meta)- {- char * local = NULL;- if (cache && HTCacheRoot) {- if (meta) {- if ((local = (char *) HT_MALLOC(strlen(HTCacheRoot) + 10 +- strlen(HT_CACHE_META) +- strlen(cache->cachename))) == NULL)- HT_OUTOFMEM("HTCache_location");- sprintf(local, "%s%d/%s%s", HTCacheRoot, cache->hash, cache->cachename,- HT_CACHE_META);- } else {- if ((local = (char *) HT_MALLOC(strlen(HTCacheRoot) + 10 +- strlen(cache->cachename))) == NULL)- HT_OUTOFMEM("HTCache_location");- sprintf(local, "%s%d/%s", HTCacheRoot, cache->hash, cache->cachename);- }- }- return local;- }- - /*- ** Is we have a valid entry in the cache then we also need a location- ** where we can get it. Hopefully, we may be able to access it- ** thourgh one of our protocol modules, for example the local file- ** module. The name returned is in URL syntax and must be freed by- ** the caller- */ PUBLIC char * HTCache_name (HTCache * cache) { if (cache && HTCacheRoot) {--- 1187,1192 ----****************** 1141,1156 **** */ PUBLIC BOOL HTCache_remove (HTCache * cache) {! if (cache && !HTCache_hasLock(cache)) {! char * head = HTCache_location(cache, YES);! char * body = HTCache_location(cache, NO);! REMOVE(head);! REMOVE(body);! HT_FREE(head);! HT_FREE(body);! return HTCache_delete(cache);! }! return NO; } /*--- 1204,1210 ---- */ PUBLIC BOOL HTCache_remove (HTCache * cache) {! return flush_object(cache) && HTCache_delete(cache); } /*Index: Library/Repository/src/HTCache.htmldiff -c Library/Repository/src/HTCache.html:2.12 Library/Repository/src/HTCache.html:2.13*** Library/Repository/src/HTCache.html:2.12 Mon Sep 9 12:23:03 1996--- Library/Repository/src/HTCache.html Thu Sep 12 22:05:24 1996****************** 210,216 **** extern BOOL HTCache_remove (HTCache * cache); </PRE> <H3>! Delete All Cache Objects </H3> <P> Destroys all cache entried in memory but does not write anything to disk.--- 210,216 ---- extern BOOL HTCache_remove (HTCache * cache); </PRE> <H3>! Delete All Cache Objects in Memory </H3> <P> Destroys all cache entried in memory but does not write anything to disk.****************** 219,224 ****--- 219,234 ---- extern BOOL HTCache_deleteAll (void); </PRE> <H3>+ Delete all Cache Object and File Entries+ </H3>+ <P>+ Destroys all cache entried in memory <B>and</B> on disk. This call basically+ resets the cache to the inital state but it does not terminate the cache.+ That is, you don't have to reinitialize the cache before you can use it again.+ <PRE>+ extern BOOL HTCache_flushAll (void);+ </PRE>+ <H3> Find a Cached Object </H3> <P>****************** 296,301 **** <P> <HR> <ADDRESS>! @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ </ADDRESS> </BODY></HTML>--- 306,311 ---- <P> <HR> <ADDRESS>! @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ </ADDRESS> </BODY></HTML>Index: Library/Repository/src/HTFilter.cdiff -c Library/Repository/src/HTFilter.c:2.13 Library/Repository/src/HTFilter.c:2.14*** Library/Repository/src/HTFilter.c:2.13 Mon Sep 9 12:23:04 1996--- Library/Repository/src/HTFilter.c Thu Sep 12 22:05:25 1996****************** 3,9 **** ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This module implrments a set of default filters that can be registerd ** as BEFORE and AFTER filters to the Net manager--- 3,9 ---- ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This module implrments a set of default filters that can be registerd ** as BEFORE and AFTER filters to the Net manager****************** 264,269 ****--- 264,277 ---- void * document = HTAnchor_document(anchor); /*+ ** We only check the memory cache if it's a GET method+ */+ if (HTRequest_method(request) != METHOD_GET) {+ if (CACHE_TRACE) HTTrace("Mem Cache... We only check GET methods\n");+ return HT_OK;+ }+ + /* ** If we are asked to flush the persistent cache then there is no reason ** to do anything here - we're flushing it anyway. Also if no document ** then just exit from this filter.****************** 278,286 **** ** have the object in the history list. Depending on what the user asked, ** we can add a cache validator */ if (document) {- HTExpiresMode expires = HTCacheMode_expires(); if (validation != HT_CACHE_FLUSH_MEM) { if (CACHE_TRACE) HTTrace("Mem Cache... Document already in memory\n"); if (expires != HT_EXPIRES_IGNORE) {--- 286,295 ---- ** have the object in the history list. Depending on what the user asked, ** we can add a cache validator */+ #if 0 if (document) { if (validation != HT_CACHE_FLUSH_MEM) {+ HTExpiresMode expires = HTCacheMode_expires(); if (CACHE_TRACE) HTTrace("Mem Cache... Document already in memory\n"); if (expires != HT_EXPIRES_IGNORE) {****************** 289,299 **** ** Ask the cache manager if this object has expired. Also ** check if we should care about expiration or not. */- #if 0 if (!HTCache_isValid(anchor)) {- #else- if (1) {- #endif if (expires == HT_EXPIRES_NOTIFY) { /*--- 298,304 ----****************** 311,325 **** } } }- return HT_LOADED; /* Got it! */- } else {- - /*- ** If we were asked to validate the memory version then- ** use either the etag or the last modified for cache validation- */- HTRequest_addRqHd(request, HT_C_IF_NONE_MATCH | HT_C_IMS); } } return HT_OK; }--- 316,329 ---- } } } }+ return HT_LOADED; /* Got it! */+ }+ return HT_OK;+ #endif+ if (document && validation != HT_CACHE_FLUSH_MEM) {+ if (CACHE_TRACE) HTTrace("Mem Cache... Document already in memory\n");+ return HT_LOADED; } return HT_OK; }Index: Library/Repository/src/HTMIMERq.cdiff -c Library/Repository/src/HTMIMERq.c:2.27 Library/Repository/src/HTMIMERq.c:2.28*** Library/Repository/src/HTMIMERq.c:2.27 Sun Sep 8 18:08:31 1996--- Library/Repository/src/HTMIMERq.c Thu Sep 12 22:05:26 1996****************** 3,9 **** ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This module implements the output stream for MIME used for sending ** requests with a entity body to HTTP, NEWS, etc. or for generating--- 3,9 ---- ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH.! ** @(#) $Id: lib_5.0_1.fix,v 1.1 1996/10/06 15:19:42 frystyk Exp $ ** ** This module implements the output stream for MIME used for sending ** requests with a entity body to HTTP, NEWS, etc. or for generating****************** 209,215 **** if (me->transparent) { if (me->put_fix) { HTNet * net = HTRequest_net(me->request);! HTEvent_unregister(net->sockfd, FD_READ); me->put_fix = NO; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -