Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_url pass incorrect If-Modified-Since header(#67417) (#67419) #68868

Merged
merged 1 commit into from Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,2 @@
bugfixes:
- get_url pass incorrect If-Modified-Since header (https://github.com/ansible/ansible/issues/67417)
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/urls.py
Expand Up @@ -1274,7 +1274,7 @@ def open(self, method, url, data=None, headers=None, use_proxy=None,
request.add_header('cache-control', 'no-cache')
# or we do it if the original is more recent than our copy
elif last_mod_time:
tstamp = rfc2822_date_string(last_mod_time.timetuple())
tstamp = rfc2822_date_string(last_mod_time.timetuple(), 'GMT')
request.add_header('If-Modified-Since', tstamp)

# user defined headers now, which may override things we've set above
Expand Down
2 changes: 1 addition & 1 deletion test/units/module_utils/urls/test_Request.py
Expand Up @@ -415,7 +415,7 @@ def test_Request_open_last_mod(urlopen_mock, install_opener_mock):
args = urlopen_mock.call_args[0]
req = args[0]

assert req.headers.get('If-modified-since') == now.strftime('%a, %d %b %Y %H:%M:%S -0000')
assert req.headers.get('If-modified-since') == now.strftime('%a, %d %b %Y %H:%M:%S GMT')


def test_Request_open_headers_not_dict(urlopen_mock, install_opener_mock):
Expand Down