⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cache.txt

📁 基于minigui的浏览器. 这是最新版本.
💻 TXT
字号:
 June 2000, --Jcid Last update: Oct 2004                              -------                               CACHE                              -------   The  cache  module  is  the  main  abstraction  layer  betweenrendering and networking.   The  capi module acts as a discriminating wrapper which eithercalls  the  cache  or  the  dpi routines depending on the type ofrequest.   Every  URL  must be requested using a_Capi_open_url, no matterif  it is a http, file, dpi or whatever type of request. The capiasks  the  dpi  module  for dpi URLs and the Cache for everythingelse.   Here we'll document non dpi requests.   The  cache,  at its turn, sends the requested-data from memory(if  cached),  or opens a new network connection (if not cached).   This  means  that  no  mattering whether the answer comes frommemory  or  the  net,  the  client  requests  it through the capiwrapper, in a single uniform way.                         ----------------                         CACHE PHILOSOPHY                         ----------------   Dillo's  cache  is  very  simple, every single resource that'sretrieved  (URL)  is  kept  in  memory. NOTHING is saved. This ismainly for three reasons:   - Dillo encourages personal privacy and it assures there'll beno recorded tracks of the sites you visited.   -  The Network is full of intermediate transparent proxys thatserve as caches.   -  If  you still want to have cached stuff, you can install anexternal cache server (as WWWOFFLE), and benefit from it.                         ---------------                         CACHE STRUCTURE                         ---------------   Currently, dillo's cache code is spread in different sources:mainly  in  cache.[ch],  dicache.[ch]  and  it  uses  some  otherfunctions from mime.c, Url.c and web.c.   Cache.c  is  the  principal  source,  and  it also is the mainresponsible  for  processing  cache-clients  (held  in  a queue).Dicache.c  is  the  "decompressed  image  cache" and it holds theoriginal    data   and   its   corresponding   decompressed   RGBrepresentation (more on this subject in Images.txt).   Url.c,  mime.c  and  web.c  are  used  for secondary tasks; asassigning the right "viewer" or "decoder" for a given URL.----------------A bit of history----------------   Some  time  ago,  the  cache  functions,  URL  retrieving  andexternal  protocols  were  a whole mess of mixed code, and it wasgetting  REALLY hard to fix, improve or extend the functionality.The  main  idea  of  this  "layering" is to make code-portions asindependent  as  possible  so  they  can  be  understood,  fixed,improved or replaced without affecting the rest of the browser.   An  interesting  part of the process is that, as resources areretrieved,  the  client  (dillo  in  this  case) doesn't know theContent-Type  of the resource at request-time. It only gets knownwhen  the  resource  header  is retrieved (think of http), and ithappens  when  the  cache  has the control so, the cache sets theproper  viewer for it! (unless the Callback function is specifiedwith the URL request).   You'll find a good example in http.c.   Note:  Files  don't have a header, but the file handler insidedillo  tries  to  determine the Content-Type and sends it back inHTTP form!-------------Cache clients-------------   Cache clients MUST use a_Cache_open_url to request an URL. Theclient structure and the callback-function prototype are defined,in cache.h, as follows:struct _CacheClient {   gint Key;                /* Primary Key for this client */   const char *Url;         /* Pointer to a cache entry Url */   guchar *Buf;             /* Pointer to cache-data */   guint BufSize;           /* Valid size of cache-data */   CA_Callback_t Callback;  /* Client function */   void *CbData;            /* Client function data */   void *Web;               /* Pointer to the Web structure of our client */};typedef void (*CA_Callback_t)(int Op, CacheClient_t *Client);   Notes:   * Op is the operation that the callback is asked to perform   by the cache. { CA_Send | CA_Close | CA_Abort }.   * Client: The Client structure that originated the request.--------------------------Key-functions descriptions--------------------------贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩int a_Cache_open_url(const char *Url, CA_Callback_t Call, void *CbData)   if Url is not cached      Create a cache-entry for that URL      Send client to cache queue      Initiate a new connection   else      Feed our client with cached data贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩ChainFunction_t a_Url_get_ccc_funct(const char *Url)   Scan the Url handlers for a handler that matches   If found      Return the CCC function for it   else      Return NULL   *  Ex:  If  Url is an http request, a_Http_ccc is the matchinghandler.贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩贩----------------------Redirections mechanism (HTTP 30x answers)----------------------  This is by no means complete. It's a work in progress.  Whenever  an  URL is served under an HTTP 30x header, its cacheentry  is  flagged  with 'CA_Redirect'. If it's a 301 answer, theadditional  'CA_ForceRedirect'  flag  is  also set, if it's a 302answer,  'CA_TempRedirect'  is  also set (this happens inside theCache_parse_header() function).  Later  on,  in Cache_process_queue(), when the entry is flaggedwith 'CA_Redirect' Cache_redirect() is called.-----------Notes-----------   The  whole  process is asynchronous and very complex. I'll tryto document it in more detail later (source is commented).   Currently  I  have  a drawing to understand it; hope the ASCIItranslation serves the same as the original.   If  you're  planning to understand the cache process troughly,write  me  a  note,  just  to assign a higher priority on furtherimproving of this doc.   Hope this helps!

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -