summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2012-10-18 18:43:52 +0000
committercorvid <corvid@lavabit.com>2012-10-18 18:43:52 +0000
commit774fbff0261d1aae1f47fdddfb57d390622fcd51 (patch)
tree1047f38b779c47397700d0cf63fd8aad8bcb982c /src
parent256195f1b4853655ebf4eab1b640c20f423c889e (diff)
don't view source for images
Viewing image source wasn't working anyway. I have the impression that the vsource dpi is told, e.g., "Here's 3000 bytes", and then it's only given however much it takes to reach a NULL in the image data -- but I didn't trouble myself to dig into the matter, since unformatted image source is not very informative anyway.
Diffstat (limited to 'src')
-rw-r--r--src/nav.c8
-rw-r--r--src/nav.h1
-rw-r--r--src/uicmd.cc9
3 files changed, 16 insertions, 2 deletions
diff --git a/src/nav.c b/src/nav.c
index 7a567710..83a4fd9f 100644
--- a/src/nav.c
+++ b/src/nav.c
@@ -590,6 +590,14 @@ void a_Nav_unref_buf(const DilloUrl *Url)
}
/*
+ * Wrapper for a_Capi_get_content_type().
+ */
+const char *a_Nav_get_content_type(const DilloUrl *url)
+{
+ return a_Capi_get_content_type(url);
+}
+
+/*
* Wrapper for a_Capi_set_vsource_url().
*/
void a_Nav_set_vsource_url(const DilloUrl *Url)
diff --git a/src/nav.h b/src/nav.h
index ad1270d7..2bec7e32 100644
--- a/src/nav.h
+++ b/src/nav.h
@@ -35,6 +35,7 @@ void a_Nav_save_url(BrowserWindow *bw,
const DilloUrl *url, const char *filename);
int a_Nav_get_buf(const DilloUrl *Url, char **PBuf, int *BufSize);
void a_Nav_unref_buf(const DilloUrl *Url);
+const char *a_Nav_get_content_type(const DilloUrl *url);
void a_Nav_set_vsource_url(const DilloUrl *Url);
#ifdef __cplusplus
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 6ca98280..b7c5fbf5 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -1019,14 +1019,18 @@ void a_UIcmd_copy_urlstr(BrowserWindow *bw, const char *urlstr)
*/
void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url)
{
- char *buf;
+ char *buf, *major;
int buf_size;
Dstr *dstr_url;
DilloUrl *vs_url;
static int post_id = 0;
char tag[8];
+ const char *content_type = a_Nav_get_content_type(url);
- if (a_Nav_get_buf(url, &buf, &buf_size)) {
+ a_Misc_parse_content_type(content_type, &major, NULL, NULL);
+
+ if (major && dStrAsciiCasecmp(major, "image") &&
+ a_Nav_get_buf(url, &buf, &buf_size)) {
a_Nav_set_vsource_url(url);
dstr_url = dStr_new("dpi:/vsource/:");
dStr_append(dstr_url, URL_STR(url));
@@ -1042,6 +1046,7 @@ void a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url)
dStr_free(dstr_url, 1);
a_Nav_unref_buf(url);
}
+ dFree(major);
}
/*