summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-31 04:24:55 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-31 04:24:55 (EDT)
commitcf7adf17813fa01be259d0cfd08432c7c83186e7 (patch)
treebb41680f68ac2205b15234eb2f93b1a8836a3024 /src
parent490c2d20475e8b16136422d3d426b84abb828a23 (diff)
downloadmarquee-cf7adf17813fa01be259d0cfd08432c7c83186e7.zip
marquee-cf7adf17813fa01be259d0cfd08432c7c83186e7.tar.gz
marquee-cf7adf17813fa01be259d0cfd08432c7c83186e7.tar.bz2
view-source: Handle "view-source:resources/*" paths
Diffstat (limited to 'src')
-rw-r--r--src/view-source.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/view-source.c b/src/view-source.c
index de555f8..45ce8e9 100644
--- a/src/view-source.c
+++ b/src/view-source.c
@@ -27,6 +27,7 @@
#include <webkit2/webkit2.h>
#include "application.h"
+#include "resources.h"
#include "string-utils.h"
typedef struct {
@@ -86,7 +87,8 @@ void
mq_view_source_request(WebKitURISchemeRequest *request,
MqApplication *application)
{
- gchar *path;
+ const gchar *path;
+ gchar *query_str;
GHashTable *query;
gint64 origin_tab_id;
gchar *uri;
@@ -96,15 +98,23 @@ mq_view_source_request(WebKitURISchemeRequest *request,
gsize length;
DataSignalData *data_signal_data;
- path = g_strdup(webkit_uri_scheme_request_get_path(request));
- query = mq_parse_query_string(path);
+ path = webkit_uri_scheme_request_get_path(request);
+
+ if (g_str_has_prefix(path, "resources/")) {
+ mq_resource_response(application, path + sizeof("resources"),
+ request);
+ return;
+ }
+
+ query_str = g_strdup(path);
+ query = mq_parse_query_string(query_str);
/* TODO: Handle missing tab ID ("origin-tab=0"). */
origin_tab_id = mq_atoi64(g_hash_table_lookup(query, "origin-tab"));
uri = g_strdup(g_hash_table_lookup(query, "uri"));
g_hash_table_unref(query);
- g_free(path);
+ g_free(query_str);
origin_tab = mq_application_get_tab(application, origin_tab_id);