Commit 7a8fb653 authored by David Read's avatar David Read
Browse files

Merge pull request #25 from ckan/24-verify-https-option

Add option to switch off HTTPS verifying
parents 5e8d7d8b d3a20b67
...@@ -247,6 +247,7 @@ Config settings ...@@ -247,6 +247,7 @@ Config settings
* ``ckanext-archiver.cache_url_root`` = URL where you will be publicly serving the cached files stored locally at ckanext-archiver.archive_dir. * ``ckanext-archiver.cache_url_root`` = URL where you will be publicly serving the cached files stored locally at ckanext-archiver.archive_dir.
* ``ckanext-archiver.max_content_length`` = the maximum size (in bytes) of files to archive (default ``50000000`` =50MB) * ``ckanext-archiver.max_content_length`` = the maximum size (in bytes) of files to archive (default ``50000000`` =50MB)
* ``ckanext-archiver.user_agent_string`` = identifies the archiver to servers it archives from * ``ckanext-archiver.user_agent_string`` = identifies the archiver to servers it archives from
* ``ckanext-archiver.verify_https`` = true/false whether you want to verify https connections and therefore fail if it is specified in the URL but does not verify.
4. Nightly report generation 4. Nightly report generation
......
...@@ -345,7 +345,9 @@ def download(context, resource, url_timeout=30, ...@@ -345,7 +345,9 @@ def download(context, resource, url_timeout=30,
# May raise DownloadException # May raise DownloadException
method_func = {'GET': requests.get, 'POST': requests.post}[method] method_func = {'GET': requests.get, 'POST': requests.post}[method]
res = requests_wrapper(log, method_func, url, timeout=url_timeout, res = requests_wrapper(log, method_func, url, timeout=url_timeout,
stream=True, headers=headers) stream=True, headers=headers,
verify=verify_https(),
)
url_redirected_to = res.url if url != res.url else None url_redirected_to = res.url if url != res.url else None
if context.get('previous') and ('etag' in res.headers): if context.get('previous') and ('etag' in res.headers):
...@@ -509,6 +511,11 @@ def get_plugins_waiting_on_ipipe(): ...@@ -509,6 +511,11 @@ def get_plugins_waiting_on_ipipe():
p.PluginImplementations(archiver_interfaces.IPipe)] p.PluginImplementations(archiver_interfaces.IPipe)]
def verify_https():
from pylons import config
return toolkit.asbool(config.get('ckanext-archiver.verify_https', True))
def _clean_content_type(ct): def _clean_content_type(ct):
# For now we should remove the charset from the content type and # For now we should remove the charset from the content type and
# handle it better, differently, later on. # handle it better, differently, later on.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment