Dillo v3.1.1-111-gd4f56d0d
|
Go to the source code of this file.
Classes | |
struct | CacheClient |
Data structure for cache clients. More... | |
Macros | |
#define | CA_Send (0) /* Normal update */ |
#define | CA_Close (1) /* Successful operation close */ |
#define | CA_Abort (2) /* Operation abort */ |
#define | CA_GotHeader 0x1 /* True after header is completely got */ |
#define | CA_GotContentType 0x2 /* True after Content-Type is known */ |
#define | CA_GotLength 0x4 /* True if Content-Length is known */ |
#define | CA_InProgress 0x8 /* True if we are getting data */ |
#define | CA_Redirect 0x10 /* Data actually points to a redirect */ |
#define | CA_ForceRedirect 0x20 /* Unconditional redirect */ |
#define | CA_TempRedirect 0x40 /* Temporary redirect */ |
#define | CA_NotFound 0x80 /* True if remote server didn't find the URL */ |
#define | CA_Aborted 0x100 /* Aborted before getting full data */ |
#define | CA_MsgErased 0x200 /* Used to erase the bw's status bar */ |
#define | CA_RedirectLoop 0x400 /* Redirect loop */ |
#define | CA_InternalUrl 0x800 /* URL content is generated by dillo */ |
#define | CA_HugeFile 0x1000 /* URL content is too big */ |
#define | CA_IsEmpty 0x2000 /* True until a byte of content arrives */ |
#define | CA_KeepAlive 0x4000 |
Typedefs | |
typedef struct CacheClient | CacheClient_t |
typedef void(* | CA_Callback_t) (int Op, CacheClient_t *Client) |
Callback type for cache clients. | |
Functions | |
void | a_Cache_init (void) |
Initialize cache data. | |
int | a_Cache_open_url (void *Web, CA_Callback_t Call, void *CbData) |
Try finding the url in the cache. | |
int | a_Cache_get_buf (const DilloUrl *Url, char **PBuf, int *BufSize) |
Get the pointer to the URL document, and its size, from the cache entry. | |
void | a_Cache_unref_buf (const DilloUrl *Url) |
Unreference the data buffer when no longer using it. | |
const char * | a_Cache_get_content_type (const DilloUrl *url) |
Get current Content-Type for cache entry found by URL. | |
const char * | a_Cache_set_content_type (const DilloUrl *url, const char *ctype, const char *from) |
Change Content-Type for cache entry found by url. | |
uint_t | a_Cache_get_flags (const DilloUrl *url) |
Get cache entry status. | |
uint_t | a_Cache_get_flags_with_redirection (const DilloUrl *url) |
Get cache entry status (following redirections). | |
bool_t | a_Cache_process_dbuf (int Op, const char *buf, size_t buf_size, const DilloUrl *Url) |
Receive new data, update the reception buffer (for next read), update the cache, and service the client queue. | |
int | a_Cache_download_enabled (const DilloUrl *url) |
Check whether a URL scheme is downloadable. | |
void | a_Cache_entry_remove_by_url (DilloUrl *url) |
Wrapper for capi. | |
void | a_Cache_freeall (void) |
Memory deallocator (only called at exit time) | |
CacheClient_t * | a_Cache_client_get_if_unique (int Key) |
Last Client for this entry? | |
void | a_Cache_stop_client (int Key) |
Remove a client from the client queue TODO: notify the dicache and upper layers. | |
#define CA_Aborted 0x100 /* Aborted before getting full data */ |
#define CA_GotContentType 0x2 /* True after Content-Type is known */ |
#define CA_GotHeader 0x1 /* True after header is completely got */ |
#define CA_GotLength 0x4 /* True if Content-Length is known */ |
#define CA_InternalUrl 0x800 /* URL content is generated by dillo */ |
#define CA_IsEmpty 0x2000 /* True until a byte of content arrives */ |
#define CA_MsgErased 0x200 /* Used to erase the bw's status bar */ |
#define CA_NotFound 0x80 /* True if remote server didn't find the URL */ |
#define CA_Redirect 0x10 /* Data actually points to a redirect */ |
typedef void(* CA_Callback_t) (int Op, CacheClient_t *Client) |
typedef struct CacheClient CacheClient_t |
CacheClient_t * a_Cache_client_get_if_unique | ( | int | Key | ) |
Last Client for this entry?
Definition at line 1399 of file cache.c.
References Cache_client_by_key_cmp(), ClientQueue, dList_find_custom(), dList_nth_data(), INT2VOIDP, and CacheClient::Url.
Referenced by a_Capi_stop_client().
int a_Cache_download_enabled | ( | const DilloUrl * | url | ) |
Check whether a URL scheme is downloadable.
Definition at line 1093 of file cache.c.
References dStrAsciiCasecmp(), and URL_SCHEME.
Referenced by a_Capi_open_url(), and Cache_process_queue().
void a_Cache_entry_remove_by_url | ( | DilloUrl * | url | ) |
Wrapper for capi.
Definition at line 357 of file cache.c.
References Cache_entry_remove().
Referenced by a_Capi_ccc().
void a_Cache_freeall | ( | void | ) |
Memory deallocator (only called at exit time)
Definition at line 1448 of file cache.c.
References Cache_client_dequeue(), Cache_entry_free(), CachedURLs, ClientQueue, dList_free(), dList_nth_data(), and dList_remove_fast().
Referenced by main().
int a_Cache_get_buf | ( | const DilloUrl * | Url, |
char ** | PBuf, | ||
int * | BufSize | ||
) |
Get the pointer to the URL document, and its size, from the cache entry.
Definition at line 552 of file cache.c.
References Cache_data(), Cache_entry_search_with_redirect(), Cache_ref_data(), Dstr::len, and Dstr::str.
Referenced by a_Capi_get_buf().
const char * a_Cache_get_content_type | ( | const DilloUrl * | url | ) |
Get current Content-Type for cache entry found by URL.
Definition at line 472 of file cache.c.
References Cache_current_content_type(), and Cache_entry_search_with_redirect().
Referenced by a_Capi_get_content_type().
Get cache entry status.
Definition at line 406 of file cache.c.
References Cache_entry_search().
Referenced by a_Capi_get_flags().
Get cache entry status (following redirections).
Definition at line 415 of file cache.c.
References Cache_entry_search_with_redirect().
Referenced by a_Capi_get_flags_with_redirection().
void a_Cache_init | ( | void | ) |
Initialize cache data.
Definition at line 118 of file cache.c.
References a_Url_free(), a_Url_new(), AboutSplash, Cache_entry_inject(), CachedURLs, ClientQueue, DelayedQueue, dList_new(), dStr_free(), and dStr_new().
Referenced by a_Capi_init().
int a_Cache_open_url | ( | void * | web, |
CA_Callback_t | Call, | ||
void * | CbData | ||
) |
Try finding the url in the cache.
If it hits, send the cache contents from there. If it misses, set up a new connection.
Definition at line 376 of file cache.c.
References Cache_client_enqueue(), Cache_delayed_process_queue(), Cache_entry_add(), Cache_entry_remove(), Cache_entry_search(), _DilloWeb::url, URL_E2EQuery, and URL_FLAGS.
Referenced by a_Capi_open_url().
Receive new data, update the reception buffer (for next read), update the cache, and service the client queue.
This function gets called whenever the IO has new data. 'Op' is the operation to perform 'VPtr' is a (void) pointer to the IO control structure
Definition at line 897 of file cache.c.
References _MSG, a_Bw_remove_client(), a_Decode_process(), a_Decode_transfer_finished(), a_Decode_transfer_process(), _DilloWeb::bw, CA_Aborted, CA_GotHeader, CA_GotLength, CA_KeepAlive, Cache_client_dequeue(), Cache_entry_search(), Cache_finish_msg(), Cache_get_header(), Cache_parse_header(), Cache_process_queue(), ClientQueue, dList_nth_data(), dReturn_val_if_fail, dStr_append_l(), dStr_free(), FALSE, IOAbort, IOClose, IORead, CacheClient::Key, Dstr::len, MSG, Dstr::str, TRUE, CacheClient::Url, URL_STR, and CacheClient::Web.
Referenced by a_Capi_ccc().
const char * a_Cache_set_content_type | ( | const DilloUrl * | url, |
const char * | ctype, | ||
const char * | from | ||
) |
Change Content-Type for cache entry found by url.
from = { "http" | "meta" }
Definition at line 492 of file cache.c.
References _MSG, a_Decode_charset_init(), a_Decode_free(), a_Misc_content_type_cmp(), a_Misc_parse_content_type(), Cache_current_content_type(), Cache_entry_search(), dFree(), dReturn_val_if_fail, dStr_free(), dStrconcat(), dStrdup(), dStrnAsciiCasecmp(), and URL_STR.
Referenced by a_Capi_set_content_type(), and Cache_parse_header().
void a_Cache_stop_client | ( | int | Key | ) |
Remove a client from the client queue TODO: notify the dicache and upper layers.
Definition at line 1419 of file cache.c.
References _MSG, a_Dicache_get_entry(), a_Dicache_unref(), Cache_client_by_key_cmp(), Cache_client_dequeue(), Cache_entry_search(), ClientQueue, DelayedQueue, dList_find_custom(), dList_remove(), INT2VOIDP, CacheClient::Url, and CacheClient::Version.
Referenced by a_Capi_stop_client(), and Cache_entry_remove().
void a_Cache_unref_buf | ( | const DilloUrl * | Url | ) |
Unreference the data buffer when no longer using it.
Definition at line 571 of file cache.c.
References Cache_entry_search_with_redirect(), and Cache_unref_data().
Referenced by a_Capi_unref_buf().