summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-03-15 15:53:20 +0000
committerJames Bursa <james@netsurf-browser.org>2003-03-15 15:53:20 +0000
commit91f8a679db6211b883ce2a7499728ee2b6a5f2af (patch)
treec210a7dbf57352499bda4d5ea97ae24df49d4b5e /content
parente517a39dfbaf633ec449dab351bca094e6be4239 (diff)
downloadnetsurf-91f8a679db6211b883ce2a7499728ee2b6a5f2af.tar.gz
netsurf-91f8a679db6211b883ce2a7499728ee2b6a5f2af.tar.bz2
[project @ 2003-03-15 15:53:20 by bursa]
MIME types for local files, new test files. svn path=/import/netsurf/; revision=107
Diffstat (limited to 'content')
-rw-r--r--content/fetch.c23
-rw-r--r--content/fetch.h3
2 files changed, 14 insertions, 12 deletions
diff --git a/content/fetch.c b/content/fetch.c
index 6e6e50ce3..9314bedeb 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -1,8 +1,9 @@
/**
- * $Id: fetch.c,v 1.2 2003/02/25 21:00:27 bursa Exp $
+ * $Id: fetch.c,v 1.3 2003/03/15 15:53:20 bursa Exp $
*/
#include <assert.h>
+#include <string.h>
#include <time.h>
#include "curl/curl.h"
#include "netsurf/content/fetch.h"
@@ -112,13 +113,6 @@ struct fetch * fetch_start(char *url, char *referer,
codem = curl_multi_add_handle(curl_multi, fetch->curl_handle);
assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM);
- /* do any possible work on the fetch */
- while (codem == CURLM_CALL_MULTI_PERFORM) {
- int running;
- codem = curl_multi_perform(curl_multi, &running);
- assert(codem == CURLM_OK || codem == CURLM_CALL_MULTI_PERFORM);
- }
-
return fetch;
}
@@ -212,14 +206,21 @@ size_t fetch_curl_data(void * data, size_t size, size_t nmemb, struct fetch *f)
if (!f->had_headers) {
/* find the content type and inform the caller */
- char *type;
+ const char *type;
CURLcode code;
code = curl_easy_getinfo(f->curl_handle, CURLINFO_CONTENT_TYPE, &type);
assert(code == CURLE_OK);
- if (type == 0)
- type = "text/html"; /* TODO: find type of file: urls */
+ if (type == 0) {
+ type = "text/html";
+ if (strncmp(f->url, "file:///", 8) == 0) {
+ char *url_path;
+ url_path = curl_unescape(f->url + 8, (int) strlen(f->url) - 8);
+ type = fetch_filetype(url_path);
+ free(url_path);
+ }
+ }
LOG(("FETCH_TYPE, '%s'", type));
f->callback(FETCH_TYPE, f->p, type, 0);
diff --git a/content/fetch.h b/content/fetch.h
index 171bf33cb..ab3029b23 100644
--- a/content/fetch.h
+++ b/content/fetch.h
@@ -1,5 +1,5 @@
/**
- * $Id: fetch.h,v 1.1 2003/02/09 12:58:14 bursa Exp $
+ * $Id: fetch.h,v 1.2 2003/03/15 15:53:20 bursa Exp $
*/
#ifndef _NETSURF_DESKTOP_FETCH_H_
@@ -16,5 +16,6 @@ struct fetch * fetch_start(char *url, char *referer,
void fetch_abort(struct fetch *f);
void fetch_poll(void);
void fetch_quit(void);
+const char *fetch_filetype(const char *unix_path);
#endif