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