From 77de9c13364ab754a5490156afe26e56882f728b Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 3 Jan 2005 02:09:20 +0000 Subject: [project @ 2005-01-03 02:09:20 by jmb] Shift + Click == download svn path=/import/netsurf/; revision=1429 --- content/content.c | 1 + content/content.h | 1 + content/fetchcache.c | 12 +++++++++--- content/fetchcache.h | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'content') diff --git a/content/content.c b/content/content.c index 7dd85a668..7bade8760 100644 --- a/content/content.c +++ b/content/content.c @@ -279,6 +279,7 @@ struct content * content_create(const char *url) c->source_size = 0; c->total_size = 0; c->no_error_pages = false; + c->download = false; c->error_count = 0; c->prev = 0; diff --git a/content/content.h b/content/content.h index da565c711..387fc7a37 100644 --- a/content/content.h +++ b/content/content.h @@ -242,6 +242,7 @@ struct content { unsigned long total_size; /**< Total data size, 0 if unknown. */ bool no_error_pages; /**< Used by fetchcache(). */ + bool download; /**< Used by fetchcache(). */ /** Array of first n rendering errors or warnings. */ struct { diff --git a/content/fetchcache.c b/content/fetchcache.c index 81c608b9e..32e201081 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -53,6 +53,7 @@ static void fetchcache_error_page(struct content *c, const char *error); * \param post_urlenc url encoded post data, or 0 if none * \param post_multipart multipart post data, or 0 if none * \param cookies send and accept cookies + * \param download download, rather than render content * \return a new content, or 0 on memory exhaustion * * On success, call fetchcache_go() to start work on the new content. @@ -66,7 +67,8 @@ struct content * fetchcache(const char *url, bool no_error_pages, char *post_urlenc, struct form_successful_control *post_multipart, - bool cookies) + bool cookies, + bool download) { struct content *c; char *url1; @@ -105,6 +107,7 @@ struct content * fetchcache(const char *url, c->width = width; c->height = height; c->no_error_pages = no_error_pages; + c->download = download; return c; } @@ -223,8 +226,11 @@ void fetchcache_callback(fetch_msg msg, void *p, const char *data, return; } type = content_lookup(mime_type); - LOG(("FETCH_TYPE, type %u", type)); - res = content_set_type(c, type, mime_type, params); + LOG(("FETCH_TYPE, type %u", c->download ? + CONTENT_OTHER : type)); + res = content_set_type(c, + c->download ? CONTENT_OTHER : type, + mime_type, params); free(mime_type); for (i = 0; params[i]; i++) free(params[i]); diff --git a/content/fetchcache.h b/content/fetchcache.h index f20ab6cf9..68fe3fd7f 100644 --- a/content/fetchcache.h +++ b/content/fetchcache.h @@ -29,7 +29,8 @@ struct content * fetchcache(const char *url, bool no_error_pages, char *post_urlenc, struct form_successful_control *post_multipart, - bool cookies); + bool cookies, + bool download); void fetchcache_go(struct content *content, char *referer, void (*callback)(content_msg msg, struct content *c, void *p1, void *p2, union content_msg_data data), -- cgit v1.2.3