elwig-backend: Add WWW-Authenticate header
This commit is contained in:
@ -95,6 +95,8 @@ class ElwigApi(BaseHTTPRequestHandler):
|
|||||||
self.send_header('Access-Control-Allow-Origin', '*')
|
self.send_header('Access-Control-Allow-Origin', '*')
|
||||||
self.send_header('Access-Control-Allow-Headers', 'Authorization')
|
self.send_header('Access-Control-Allow-Headers', 'Authorization')
|
||||||
self.send_header('Access-Control-Allow-Methods', 'HEAD, GET, OPTIONS')
|
self.send_header('Access-Control-Allow-Methods', 'HEAD, GET, OPTIONS')
|
||||||
|
if status_code == 401:
|
||||||
|
self.send_header('WWW-Authenticate', 'Basic realm=Elwig')
|
||||||
if self.headers.get('Accept-Encoding') and len(data) > 64:
|
if self.headers.get('Accept-Encoding') and len(data) > 64:
|
||||||
accept_encoding = [e.strip() for e in self.headers.get('Accept-Encoding').split(',')]
|
accept_encoding = [e.strip() for e in self.headers.get('Accept-Encoding').split(',')]
|
||||||
if 'gzip' in accept_encoding:
|
if 'gzip' in accept_encoding:
|
||||||
|
Reference in New Issue
Block a user