summaryrefslogtreecommitdiff
path: root/src/uicmd.cc
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/uicmd.cc
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/uicmd.cc')
-rw-r--r--src/uicmd.cc9
1 files changed, 7 insertions, 2 deletions
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);
}
/*