# eric6.WebBrowser.Network.NetworkUrlInterceptor

Module implementing a class to handle URL requests before they get processed by QtWebEngine.

### Global Attributes

None

### Classes

NetworkUrlInterceptor | Class implementing an URL request handler.

### Functions

None

## NetworkUrlInterceptor

Class implementing an URL request handler.

### Derived from

QWebEngineUrlRequestInterceptor

### Class Attributes

None

### Class Methods

None

### Methods

NetworkUrlInterceptor | Constructor
__loadSettings | Private method to load the Network Manager settings.
__potentiallyTrustworthy | Private method to check, if the given URL is potentially trustworthy.
__refererOrigin | Private method to generate an origin referer header URL.
__sameOrigin | Private method to test the "same origin" policy.
__setRefererHeader | Private method to set the 'Referer' header depending on the configured rule set.
__trimmedReferer | Private method to generate the trimmed referer header URL.
installUrlInterceptor | Public method to install an URL interceptor.
interceptRequest | Public method handling an URL request.
preferencesChanged | Public slot to handle a change of preferences.
removeUrlInterceptor | Public method to remove an URL interceptor.

### Static Methods

None

#### NetworkUrlInterceptor (Constructor)

NetworkUrlInterceptor(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### NetworkUrlInterceptor.__loadSettings

__loadSettings()

Private method to load the Network Manager settings.

#### NetworkUrlInterceptor.__potentiallyTrustworthy

__potentiallyTrustworthy(url)

Private method to check, if the given URL is potentially trustworthy.

url (QUrl)
  URL to be checked

Returns:
  flag indicating a potentially trustworthy URL

Return Type:
  bool

#### NetworkUrlInterceptor.__refererOrigin

__refererOrigin(url)

Private method to generate an origin referer header URL.

url (QUrl)
  URL to generate the header from

Returns:
  origin referer header URL

Return Type:
  QByteArray or bytes

#### NetworkUrlInterceptor.__sameOrigin

__sameOrigin(url1, url2)

Private method to test the "same origin" policy.

url1 (QUrl)
  first URL for the test
url2 (QUrl)
  second URL for the test

Returns:
  flag indicating that both URLs have the same origin

Return Type:
  bool

#### NetworkUrlInterceptor.__setRefererHeader

__setRefererHeader(info)

Private method to set the 'Referer' header depending on the configured rule set.

info (QWebEngineUrlRequestInfo)
  URL request information

See Also:
  Mozilla Referrer
  W3C Referrer Policy

#### NetworkUrlInterceptor.__trimmedReferer

__trimmedReferer(url)

Private method to generate the trimmed referer header URL.

url (QUrl)
  URL to be trimmed as a referer header

Returns:
  trimmed referer header URL

Return Type:
  QByteArray or bytes

#### NetworkUrlInterceptor.installUrlInterceptor

installUrlInterceptor(interceptor)

Public method to install an URL interceptor.

interceptor (UrlInterceptor)
  URL interceptor to be installed

#### NetworkUrlInterceptor.interceptRequest

interceptRequest(info)

Public method handling an URL request.

info (QWebEngineUrlRequestInfo)
  URL request information

#### NetworkUrlInterceptor.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### NetworkUrlInterceptor.removeUrlInterceptor

removeUrlInterceptor(interceptor)

Public method to remove an URL interceptor.

interceptor (UrlInterceptor)
  URL interceptor to be removed

Up