aboutsummaryrefslogtreecommitdiff
path: root/src/capi.c
diff options
context:
space:
mode:
authorcorvid, Jorge Arellano Cid <devnull@localhost>2009-05-06 23:43:52 +0000
committercorvid, Jorge Arellano Cid <devnull@localhost>2009-05-06 23:43:52 +0000
commitbe860639e2afa0a5513df9004a6a8bff4848dd29 (patch)
tree5fe7f979fbdca8df9896564126483e8c7270a57e /src/capi.c
parentbc5154c07731b1c415ec2cbf897bef6a889b9293 (diff)
separate a_Capi_get_flags and a_Capi_get_flags_with_redirection
Diffstat (limited to 'src/capi.c')
-rw-r--r--src/capi.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/capi.c b/src/capi.c
index 8220e206..faa3035e 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -314,7 +314,7 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
if (web->flags & WEB_Download) {
/* download request: if cached save from cache, else
* for http, ftp or https, use the downloads dpi */
- if (a_Capi_get_flags(web->url) & CAPI_IsCached) {
+ if (a_Capi_get_flags_with_redirection(web->url) & CAPI_IsCached) {
if (web->filename) {
if ((web->stream = fopen(web->filename, "w"))) {
use_cache = 1;
@@ -376,12 +376,11 @@ int a_Capi_open_url(DilloWeb *web, CA_Callback_t Call, void *CbData)
}
/*
- * Return status information of an URL's content-transfer process.
+ * Convert cache-defined flags to Capi ones.
*/
-int a_Capi_get_flags(const DilloUrl *Url)
+static int Capi_map_cache_flags(uint_t flags)
{
int status = 0;
- uint_t flags = a_Cache_get_flags(Url);
if (flags) {
status |= CAPI_IsCached;
@@ -398,6 +397,26 @@ int a_Capi_get_flags(const DilloUrl *Url)
}
/*
+ * Return status information of an URL's content-transfer process.
+ */
+int a_Capi_get_flags(const DilloUrl *Url)
+{
+ uint_t flags = a_Cache_get_flags(Url);
+ int status = flags ? Capi_map_cache_flags(flags) : 0;
+ return status;
+}
+
+/*
+ * Same as a_Capi_get_flags() but following redirections.
+ */
+int a_Capi_get_flags_with_redirection(const DilloUrl *Url)
+{
+ uint_t flags = a_Cache_get_flags_with_redirection(Url);
+ int status = flags ? Capi_map_cache_flags(flags) : 0;
+ return status;
+}
+
+/*
* Get the cache's buffer for the URL, and its size.
* Return: 1 cached, 0 not cached.
*/