亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? htcache.c

?? www工具包. 這是W3C官方支持的www支撐庫. 其中提供通用目的的客戶端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
?? C
?? 第 1 頁 / 共 5 頁
字號:
    	    if (!anchor) anchor = HTRequest_anchor(request);	    HTCache_touch(request, response, anchor);	} else {	    HTParentAnchor * anchor = HTRequest_anchor(request);	    char * default_name = HTRequest_defaultPutName(request);	    HTCache * cache = HTCache_find(anchor, default_name);	    if (cache) {		/* 		** If we receive a 204 and the method is unsafe then we have		** to delete the cache body but not the header information		*/		/*		** @@ JK: see how to add all the methods here (201, etc.) when		** it's a PUT		*/		if (status == 204) {		    HTCache_updateMeta(cache, request, response);		    cache->size = 0;		    cache->range = YES;		    /* @@ JK: update the cache meta data on disk */		    HTCache_writeMeta (cache, request, response);		    /* @@ JK: and we remove the file name as it's obsolete 		       now */		    REMOVE(cache->cachename);		} else		    HTCache_remove(cache);	    } 	    /* @@  this operation will clear the cache->size and cache_range */	    HTCache_touch(request, response, anchor);	}    }    return HT_OK;}/***  Set the size of a cached object. We don't consider the metainformation as**  part of the size which is the the reason for why the min cache size should**  not be less than 5M. When we set the cache size we also check whether we **  should run the gc or not.*/PRIVATE BOOL HTCache_setSize (HTCache * cache, long written, BOOL append){    if (cache) {	/*	**  First look to see if we already have registered this cache entry	**  with a certain size. This size may be a subpart of the total entity	**  (in case the download was interrupted)	*/	if (cache->size > 0 && !append) HTCacheContentSize -= cache->size;	cache->size = written;	HTCacheContentSize += written;	/*	**  Now add the new size to the total cache size. If the new size is	**  bigger than the legal cache size then start the gc.	*/	HTTRACE(CACHE_TRACE, "Cache....... Total size %ld\n" _ HTCacheContentSize);	if (startGC()) HTCacheGarbage();	return YES;    }    return NO;}/***  Verifies if a cache object exists for this URL and if so returns a URL**  for the cached object. It does not verify whether the object is valid or**  not, for example it might have expired.****  Returns: file name	If OK (must be freed by caller)**	     NULL	If no cache object found*/PUBLIC HTCache * HTCache_find (HTParentAnchor * anchor, char * default_name){    HTList * list = NULL;    HTCache * pres = NULL;    /* Find a hash entry for this URL */    if (HTCacheMode_enabled() && anchor && CacheTable) {	char * url = NULL;	int hash = 0;	char * ptr;	if (default_name)	    StrAllocCopy (url, default_name);	  else	    url = HTAnchor_address((HTAnchor *) anchor);	ptr = url;	for (; *ptr; ptr++)	    hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HT_XL_HASH_SIZE);	if (!CacheTable[hash]) {	    HT_FREE(url);	    return NULL;	}	list = CacheTable[hash];	/* Search the cache */	{	    HTList * cur = list;	    while ((pres = (HTCache *) HTList_nextObject(cur))) {		if (!strcmp(pres->url, url)) {		    HTTRACE(CACHE_TRACE, "Cache....... Found %p hits %d\n" _ 					     pres _ pres->hits);		    break;		}	    }	}	HT_FREE(url);    }    return pres;}/*	HTCache_delete**	--------------**	Deletes a cache entry*/PRIVATE BOOL HTCache_delete (HTCache * cache){    if (cache && CacheTable) {	HTList * cur = CacheTable[cache->hash];	return cur && delete_object(cur, cache);    }    return NO;}/*	HTCache_deleteAll**	-----------------**	Destroys all cache entried in memory but does not write anything to**	disk*/PUBLIC BOOL HTCache_deleteAll (void){    if (CacheTable) {	HTList * cur;	int cnt;	/* Delete the rest */	for (cnt=0; cnt<HT_XL_HASH_SIZE; cnt++) {	    if ((cur = CacheTable[cnt])) { 		HTCache * pres;		while ((pres = (HTCache *) HTList_nextObject(cur)) != NULL)		    free_object(pres);	    }	    HTList_delete(CacheTable[cnt]);	}	HT_FREE(CacheTable);	HTCacheContentSize = 0L;	return YES;    }    return NO;}/***  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_metaLocation (HTCache * cache){    char * local = NULL;    if (cache && cache->cachename && *cache->cachename) {	if ((local = (char *) HT_MALLOC(strlen(cache->cachename) +					strlen(HT_CACHE_META) + 5)) == NULL)	    HT_OUTOFMEM("HTCache_metaLocation");	sprintf(local, "%s%s", cache->cachename, HT_CACHE_META);    }    return local;}/***  Walk through the set of headers and write those out that we are allowed**  to store in the cache. We look into the connection header to see what the **  hop-by-hop headers are and also into the cache-control directive to see what**  headers should not be cached.*/PRIVATE BOOL meta_write (FILE * fp, HTRequest * request, HTResponse * response){    if (fp && request && response) {	HTAssocList * headers = HTAnchor_header(HTRequest_anchor(request));	HTAssocList * connection = HTResponse_connection(response);	char * nocache = HTResponse_noCache(response);	/*	**  If we don't have any headers then just return now.	*/	if (!headers) return NO;	/*	**  Check whether either the connection header or the cache control	**  header includes header names that we should not cache	*/	if (connection || nocache) {	    /*	    **  Walk though the cache control no-cache directive	    */	    if (nocache) {		char * line = NULL;		char * ptr = NULL;		char * field = NULL;		StrAllocCopy(line, nocache);		 /* Get our own copy */		ptr = line;		while ((field = HTNextField(&ptr)) != NULL)		    HTAssocList_removeObject(headers, field);		HT_FREE(line);	    }	    /*	    **  Walk though the connection header	    */	    if (connection) {		HTAssoc * pres;		while ((pres=(HTAssoc *) HTAssocList_nextObject(connection))) {		    char * field = HTAssoc_name(pres);		    HTAssocList_removeObject(headers, field);		}	    }	}	/*	**  Write out the remaining list of headers that we not already store	**  in the index file.	*/	{	    HTAssocList * cur = headers;	    HTAssoc * pres;	    while ((pres = (HTAssoc *) HTAssocList_nextObject(cur))) {		char * name = HTAssoc_name(pres);		/* Don't write the headers that are already hop-by-hop */		if (strcasecomp(name, "connection") &&		    strcasecomp(name, "keep-alive") &&		    strcasecomp(name, "proxy-authenticate") &&		    strcasecomp(name, "proxy-authorization") &&		    strcasecomp(name, "transfer-encoding") &&		    strcasecomp(name, "upgrade")) {		    if (fprintf(fp, "%s: %s\n", name, HTAssoc_value(pres)) < 0) {			HTTRACE(CACHE_TRACE, "Cache....... Error writing metainfo\n");			return NO;		    }		}	    }	}	/*	**  Terminate the header with a newline	*/	if (fprintf(fp, "\n") < 0) {	    HTTRACE(CACHE_TRACE, "Cache....... Error writing metainfo\n");	    return NO;	}	return YES;    }    return NO;}/***  Save the metainformation for the data object. If no headers**  are available then the meta file is empty*/PUBLIC BOOL HTCache_writeMeta (HTCache * cache, HTRequest * request,			       HTResponse * response){    if (cache && request && response) {	BOOL status;	FILE * fp;	char * name = HTCache_metaLocation(cache);	if (!name) {	    HTTRACE(CACHE_TRACE, "Cache....... Invalid cache entry\n");	    HTCache_remove(cache);	    return NO;	}	if ((fp = fopen(name, "wb")) == NULL) {	    HTTRACE(CACHE_TRACE, "Cache....... Can't open `%s\' for writing\n" _ name);	    HTCache_remove(cache);	    HT_FREE(name);	    	    return NO;	}	status = meta_write(fp, request, response);	fclose(fp);	HT_FREE(name);	return status;    }    return NO;}PRIVATE BOOL meta_read (FILE * fp, HTRequest * request, HTStream * target){    if (fp && request && target) {	int status;	char buffer[512];	while (1) {	    if ((status = fread(buffer, 1, 512, fp)) <= 0) {		HTTRACE(PROT_TRACE, "Cache....... Meta information loaded\n");		return YES;	    }		    /* Send the data down the pipe */	    status = (*target->isa->put_block)(target, buffer, status);	    if (status == HT_LOADED) {		(*target->isa->flush)(target);		return YES;	    }	    if (status < 0) {		HTTRACE(PROT_TRACE, "Cache....... Target ERROR %d\n" _ status);		break;	    }	}    }    return NO;}/***  Read the metainformation for the data object. If no headers are**  available then the meta file is empty*/PRIVATE BOOL HTCache_readMeta (HTCache * cache, HTRequest * request){    HTParentAnchor * anchor = HTRequest_anchor(request);    if (cache && request && anchor) {	BOOL status;	FILE * fp;	char * name = HTCache_metaLocation(cache);	if (!name) {	    HTTRACE(CACHE_TRACE, "Cache....... Invalid meta name\n" _ name);	    HTCache_remove(cache);	    return NO;	}	HTTRACE(CACHE_TRACE, "Cache....... Looking for `%s\'\n" _ name);	if ((fp = fopen(name, "rb")) == NULL) {	    HTTRACE(CACHE_TRACE, "Cache....... Can't open `%s\' for reading\n" _ name);	    HTCache_remove(cache);	    HT_FREE(name);	    	} else {	    HTStream * target = HTStreamStack(WWW_MIME_HEAD, WWW_DEBUG,					      HTBlackHole(), request, NO);	    /*	    **  Make sure that we save the reponse information in the anchor	    */	    HTResponse_setCachable(HTRequest_response(request), HT_CACHE_ALL);	    status = meta_read(fp, request, target);	    (*target->isa->_free)(target);	    /* JK: Moved the delete outside of meta_read, because it was being	       deleted multiple times. 	       Delete the response headers. In principle, they are	       already available in the anchor */ 	    HTRequest_setResponse(request, NULL);	    fclose(fp);	    HT_FREE(name);	    return status;	}    }    return NO;}/***  Merge metainformation with existing version. This means that we have had a**  successful validation and hence a true cache hit. We only regard the**  following headers: Date, content-location, expires, cache-control, and vary.*/PUBLIC BOOL HTCache_updateMeta (HTCache * cache, HTRequest * request,				HTResponse * response){    if (cache && request && response) {	HTParentAnchor * anchor = HTRequest_anchor(request);	cache->hits++;	/* Calculate the various times */	calculate_time(cache, request, response);	/* Get the last-modified and etag values if any */	{	    char * etag = HTAnchor_etag(anchor);	    if (etag) StrAllocCopy(cache->etag, etag);	    cache->lm = HTAnchor_lastModified(anchor);	}	/* Must we revalidate this every time? */	cache->must_revalidate = HTResponse_mustRevalidate(response);	return YES;    }    return NO;}PUBLIC BOOL HTCache_resetMeta (HTCache * cache, HTRequest * request,				HTResponse * response){  /* what a problem... we update the cache with the wrong data     from the response... after the redirection */  HTCache_updateMeta (cache, request, response);  cache->size = 0;  cache->range = YES;  /* @@ JK: update the cache meta data on disk */  HTCache_writeMeta (cache, request, response);  /* @@ JK: and we remove the file name as it's obsolete      now */  REMOVE(cache->cachename);  return YES;}/***  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_metaLocation(cache);	REMOVE(head);	HT_FREE(head);	REMOVE(cache->cachename);	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<HT_XL_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);	HTCacheContentSize = 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**  version. We also check the cache control directives in the request to**  see if they change the freshness discission. */PUBLIC HTReload HTCache_isFresh (HTCache * cache, HTRequest * request)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品乱人伦中文| 日欧美一区二区| 亚洲免费观看高清完整版在线观看| 亚洲资源中文字幕| 国产福利一区在线观看| 欧美日韩一级视频| 国产精品网站导航| 美女性感视频久久| 欧美精选午夜久久久乱码6080| 国产精品私人影院| 免费成人在线视频观看| 在线视频国产一区| 中文幕一区二区三区久久蜜桃| 青青草伊人久久| 在线观看一区二区精品视频| 风间由美一区二区av101 | 久久成人免费电影| 成人午夜电影小说| 国产欧美精品一区二区色综合 | 日韩不卡免费视频| 欧美一区二区三区思思人| 国产精品综合在线视频| 亚洲国产精品一区二区www在线| 色欧美片视频在线观看在线视频| 综合久久久久久久| 国产女同互慰高潮91漫画| 国产精品538一区二区在线| 精品视频一区二区三区免费| 国产成人午夜精品5599| 欧美不卡激情三级在线观看| 91农村精品一区二区在线| 精品播放一区二区| 91福利在线免费观看| 亚洲va韩国va欧美va| 欧美性猛交xxxx乱大交退制版| 一区在线播放视频| 26uuu亚洲综合色欧美 | 亚洲精品视频观看| 一区二区三区四区乱视频| 精品久久久久久综合日本欧美| 日韩一级片在线观看| 亚洲国产精品成人综合| 一区二区激情小说| 国产视频一区二区在线| 欧美日韩亚洲另类| 欧美日韩日日摸| 在线播放91灌醉迷j高跟美女 | 亚洲国产成人高清精品| 亚洲国产aⅴ成人精品无吗| 美女视频一区在线观看| 成人高清视频免费观看| 欧美剧在线免费观看网站| 久久综合九色综合欧美98| 一区二区视频免费在线观看| 欧美一卡二卡三卡| 日韩一区二区免费高清| 又紧又大又爽精品一区二区| 久久精品999| 欧美日韩免费一区二区三区| 精品国精品自拍自在线| 亚洲成人av一区| 91免费在线视频观看| 欧美国产亚洲另类动漫| 日韩欧美电影一区| 亚洲人成网站影音先锋播放| 精品一区二区三区的国产在线播放| bt欧美亚洲午夜电影天堂| 国产日韩视频一区二区三区| 亚洲3atv精品一区二区三区| 不卡av在线网| 国产精品欧美久久久久一区二区| 久久成人免费网| 日本一区二区三区国色天香| 欧美午夜一区二区三区免费大片| 久久久一区二区三区| 国产很黄免费观看久久| 久久久精品中文字幕麻豆发布| 激情小说欧美图片| 久久久欧美精品sm网站| 国产精品一区二区三区四区 | 亚洲视频一区在线| 99久久免费精品| 色欧美88888久久久久久影院| 色一情一伦一子一伦一区| 亚洲韩国一区二区三区| 欧美精品日韩精品| 国内精品伊人久久久久av一坑| 中文字幕精品一区| 欧美区一区二区三区| 麻豆精品在线播放| 成人免费在线播放视频| 欧美三级资源在线| www.在线成人| 国产精品家庭影院| 欧美精品电影在线播放| 国产激情视频一区二区在线观看| 亚洲精品日韩综合观看成人91| 欧美一级一区二区| 91丨九色丨国产丨porny| 日本强好片久久久久久aaa| 国产精品国产三级国产普通话三级 | 亚洲第一在线综合网站| 国产亚洲女人久久久久毛片| 欧美日韩精品一二三区| 一区二区三区**美女毛片| 成人va在线观看| 粉嫩欧美一区二区三区高清影视 | 一区二区三区四区蜜桃| 亚洲国产成人自拍| 国产日韩欧美综合在线| 日韩欧美电影一区| 精品国产伦一区二区三区观看方式| 亚洲女爱视频在线| 欧美一区二区三区成人| 欧美午夜视频网站| 在线亚洲高清视频| 欧美天堂亚洲电影院在线播放| 丁香桃色午夜亚洲一区二区三区| 久久99久久久久| 黑人巨大精品欧美一区| 国产精品一区二区久激情瑜伽| 精品伊人久久久久7777人| 久久成人免费网| 成人白浆超碰人人人人| 久久九九影视网| 中文字幕亚洲区| 中文字幕综合网| 婷婷中文字幕综合| 国产精品一区二区三区99| 国产**成人网毛片九色 | 欧美一区三区四区| 国产午夜精品久久久久久免费视 | 久久精品噜噜噜成人av农村| 亚洲一区二区黄色| 亚洲一本大道在线| 国产女人aaa级久久久级| 亚洲一区二区三区在线播放| 日韩有码一区二区三区| 蜜臂av日日欢夜夜爽一区| 国产成人精品一区二区三区四区 | 亚洲chinese男男1069| 精品国免费一区二区三区| 国产九色sp调教91| 成人激情图片网| 日韩视频123| 一区二区三区日本| www.视频一区| 日韩一区二区三区在线| 中文字幕一区二| 久草中文综合在线| 91精品国产美女浴室洗澡无遮挡| 久久奇米777| 日韩av午夜在线观看| 日韩av一区二区三区四区| 色综合天天综合网天天看片| 欧美一区二区久久久| 精品国产免费一区二区三区香蕉| 国产成人在线视频免费播放| 91原创在线视频| 国产精品免费视频观看| 精品无码三级在线观看视频| 日本精品免费观看高清观看| 欧美中文一区二区三区| 亚洲综合一区二区精品导航| 国产成人亚洲综合色影视| 精品88久久久久88久久久| 久久精品国产秦先生| 欧美欧美午夜aⅴ在线观看| 一区二区三区中文字幕电影| 成人精品国产免费网站| 国产精品二三区| 99精品视频一区二区| 亚洲人成网站影音先锋播放| 欧美mv日韩mv| 555夜色666亚洲国产免| 日韩一本二本av| 粉嫩av亚洲一区二区图片| 欧美一级精品在线| 狠狠色狠狠色综合系列| 国产日韩欧美综合一区| 成人国产精品免费| 五月天亚洲婷婷| 国产午夜精品在线观看| 欧美日韩成人综合天天影院 | 亚洲精品在线一区二区| 视频一区在线视频| 久久久久久久久久久99999| 国产精品天天摸av网| 欧美丰满少妇xxxbbb| 国产成人综合在线| 日韩精品亚洲专区| 国产精品青草久久| 欧美一级一级性生活免费录像| 伦理电影国产精品| 亚洲大型综合色站| 中文字幕一区二区三区视频| 久久久国产精华| 91精品欧美久久久久久动漫| 久久99久久久欧美国产| 日韩精品一级二级|