summaryrefslogtreecommitdiff
path: root/testenv/server
diff options
context:
space:
mode:
authorDarshit Shah <darnir@gmail.com>2015-09-22 16:38:40 +0530
committerDarshit Shah <darnir@gmail.com>2015-09-22 16:38:40 +0530
commite51076e6832d651c8b614de03c81576918fcb2f7 (patch)
tree1b6653ba875531988710beafb9070ef84c47a5e0 /testenv/server
parentc387db645184877d1236ef4dd76da1e5671ec561 (diff)
downloadwget-e51076e6832d651c8b614de03c81576918fcb2f7.tar.gz
Add tests for missing qop in digest auth
* testenv/test-auth-both.py: Add qop parameter for digest auth * testenv/test-auth-digest.py: Same * testenv/conf/authentication.py: Support additional parameters for authentication * testenv/servers/http/http_server.py: Same
Diffstat (limited to 'testenv/server')
-rw-r--r--testenv/server/http/http_server.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/testenv/server/http/http_server.py b/testenv/server/http/http_server.py
index 85769c43..78aa605e 100644
--- a/testenv/server/http/http_server.py
+++ b/testenv/server/http/http_server.py
@@ -231,11 +231,11 @@ class _Handler(BaseHTTPRequestHandler):
This method calls self.send_header() directly instead of using the
add_header() method because sending multiple WWW-Authenticate headers
actually makes sense and we do use that feature in some tests. """
- def send_challenge(self, auth_type):
+ def send_challenge(self, auth_type, auth_parm):
auth_type = auth_type.lower()
if auth_type == "both":
- self.send_challenge("basic")
- self.send_challenge("digest")
+ self.send_challenge("basic", auth_parm)
+ self.send_challenge("digest", auth_parm)
return
if auth_type == "basic":
challenge_str = 'BasIc realm="Wget-Test"'
@@ -246,7 +246,11 @@ class _Handler(BaseHTTPRequestHandler):
challenge_str = 'DIgest realm="Test", nonce="%s", opaque="%s"' % (
self.nonce,
self.opaque)
- challenge_str += ', qop="auth"'
+ try:
+ if auth_parm['qop']:
+ challenge_str += ', qop="%s"' % auth_parm['qop']
+ except KeyError:
+ pass
if auth_type == "both_inline":
# 'BasIc' to provoke a Wget failure with turkish locales
challenge_str = 'BasIc realm="Wget-Test", ' + challenge_str
@@ -324,7 +328,7 @@ class _Handler(BaseHTTPRequestHandler):
self.handle_auth(auth_rule)
except AuthError as se:
self.send_response(401, "Authorization Required")
- self.send_challenge(auth_rule.auth_type)
+ self.send_challenge(auth_rule.auth_type, auth_rule.auth_parm)
self.finish_headers()
raise se