Block all request methods in host blocker
This commit is contained in:
parent
7c6981e512
commit
a77cb44723
@ -52,6 +52,7 @@ Changed
|
||||
closes the current tab.
|
||||
- With Qt 5.9, `content -> cookies-store` can now be set on QtWebEngine without
|
||||
a restart.
|
||||
- The adblocker now also blocks non-GET requests (e.g. POST)
|
||||
|
||||
Fixed
|
||||
~~~~~
|
||||
|
@ -57,8 +57,7 @@ class RequestInterceptor(QWebEngineUrlRequestInterceptor):
|
||||
info: QWebEngineUrlRequestInfo &info
|
||||
"""
|
||||
# FIXME:qtwebengine only block ads for NavigationTypeOther?
|
||||
if (bytes(info.requestMethod()) == b'GET' and
|
||||
self._host_blocker.is_blocked(info.requestUrl())):
|
||||
if self._host_blocker.is_blocked(info.requestUrl()):
|
||||
log.webview.info("Request to {} blocked by host blocker.".format(
|
||||
info.requestUrl().host()))
|
||||
info.block(True)
|
||||
|
@ -416,8 +416,7 @@ class NetworkManager(QNetworkAccessManager):
|
||||
req.setRawHeader(header, value)
|
||||
|
||||
host_blocker = objreg.get('host-blocker')
|
||||
if (op == QNetworkAccessManager.GetOperation and
|
||||
host_blocker.is_blocked(req.url())):
|
||||
if host_blocker.is_blocked(req.url()):
|
||||
log.webview.info("Request to {} blocked by host blocker.".format(
|
||||
req.url().host()))
|
||||
return networkreply.ErrorNetworkReply(
|
||||
|
Loading…
Reference in New Issue
Block a user