From 29762c87c89a136d8fe6fb67a5b46187f3655005 Mon Sep 17 00:00:00 2001 From: bart2 Date: Thu, 22 Dec 2016 03:11:42 +0100 Subject: [PATCH] Fixes #16936 - Digest authentication not working in uri module (#18736) --- lib/ansible/module_utils/urls.py | 2 ++ test/integration/roles/test_uri/tasks/main.yml | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 1fd67bd5646..68f78c0b8ed 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -825,9 +825,11 @@ def open_url(url, data=None, headers=None, method=None, use_proxy=True, # use this username/password combination for urls # for which `theurl` is a super-url authhandler = urllib_request.HTTPBasicAuthHandler(passman) + digest_authhandler = urllib_request.HTTPDigestAuthHandler(passman) # create the AuthHandler handlers.append(authhandler) + handlers.append(digest_authhandler) elif username and force_basic_auth: headers["Authorization"] = basic_auth_header(username, password) diff --git a/test/integration/roles/test_uri/tasks/main.yml b/test/integration/roles/test_uri/tasks/main.yml index 4e7ce0c90d3..68757c0f823 100644 --- a/test/integration/roles/test_uri/tasks/main.yml +++ b/test/integration/roles/test_uri/tasks/main.yml @@ -175,6 +175,13 @@ user: user password: passwd +- name: test digest auth + uri: + url: 'http://{{ httpbin_host }}/digest-auth/auth/user/passwd' + user: user + password: passwd + HEADER_Cookie: "fake=fake_value" + - name: test PUT uri: url: 'http://{{ httpbin_host }}/put'