diff options
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/errors.py | 17 | ||||
-rw-r--r-- | ipalib/rpc.py | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/ipalib/errors.py b/ipalib/errors.py index 4463fee7..5b634880 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -441,6 +441,23 @@ class XMLRPCMarshallError(PublicError): errno = 910 format = _('error marshalling data for XML-RPC transport: %(error)s') + +class RefererError(PublicError): + """ + **911** Raised when the the request does not contain an HTTP referer + + For example: + + >>> raise RefererError() + Traceback (most recent call last): + ... + RefererError: Missing or invalid HTTP Referer + """ + + errno = 911 + format = _('Missing or invalid HTTP Referer, %(referer)s') + + ############################################################################## # 1000 - 1999: Authentication errors class AuthenticationError(PublicError): diff --git a/ipalib/rpc.py b/ipalib/rpc.py index f8e4d9e6..8ec3a2f2 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -208,6 +208,9 @@ class LanguageAwareTransport(Transport): extra_headers.append( ('Accept-Language', lang.replace('_', '-')) ) + extra_headers.append( + ('Referer', 'https://%s/ipa/xml' % str(host)) + ) return (host, extra_headers, x509) |