Test URI type with webkit instead of manually - from quinq - surf-adblock - Surf adblock web extension
(HTM) git clone git://git.codemadness.org/surf-adblock
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 45bbe933e712772b3f1513c8a8970b7e2743f07c
(DIR) parent d781090ae7718310fb13c83c1a8406be46a613b8
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 3 Jun 2017 22:09:25 +0200
Test URI type with webkit instead of manually - from quinq
The work has already been done so we should as well use it.
Diffstat:
M surf-adblock.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/surf-adblock.c b/surf-adblock.c
@@ -790,8 +790,7 @@ documentloaded(WebKitWebPage *wp, Page *p)
const char *s, *uri = webkit_web_page_get_uri(p->webpage);
size_t len;
- if (!uri || (strncmp(uri, "http://", sizeof("http://") - 1) &&
- strncmp(uri, "https://", sizeof("https://") - 1)))
+ if (!uri)
return;
s = strstr(uri, "://") + sizeof("://") - 1;
@@ -882,8 +881,7 @@ sendrequest(WebKitWebPage *wp, WebKitURIRequest *req,
gboolean status = FALSE;
if (!uri || !strcmp(requri, uri) ||
- (strncmp(uri, "http://", sizeof("http://") - 1) &&
- strncmp(uri, "https://", sizeof("https://") - 1)))
+ !webkit_uri_request_get_http_method(req))
return FALSE;
s = strstr(uri, "://") + sizeof("://") - 1;