Skip to content

Commit

Permalink
test using https for transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
astro-friedel committed Jun 25, 2020
1 parent 61dc679 commit 96ab2a8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions python/filemgmt/http_utils.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# $Id: disk_utils_local.py 18486 2014-01-29 15:58:12Z mgower $
# $Rev:: 18486 $: # Revision of last commit.
# $LastChangedBy:: mgower $: # Author of last commit.
# $LastChangedDate:: 2014-01-29 09:58:12 #$: # Date of last commit.

"""
Routines for performing tasks on files available through http.
"""

__version__ = "$Rev: 18486 $"

import os
import sys
#sys.path.append('/home/friedel/.local/lib/python2.7/site-packages')
import subprocess
import re
import traceback
import time
import certifi
import pycurl

import despyserviceaccess.serviceaccess as serviceaccess
Expand Down Expand Up @@ -86,6 +79,8 @@ def check_url(self, P):
>>> C.check_url("hello")
('hello', False)"""
if re.match("^https?:", P):
if re.match(r"^https:", P):
self.curl.setopt(pycurl.CAINFO, certifi.where())
return (P, True)
return (P, False)

Expand Down Expand Up @@ -226,7 +221,7 @@ def create_http_intermediate_dirs(self, f):
"""
# Making bar/ sometimes returns a 301 status even if there doesn't seem to be a bar/ in the directory.
m = re.match(r"(http://[^/]+)(/.*)", f)
m = re.match(r"(https?://[^/]+)(/.*)", f)
self.curl.setopt(pycurl.CUSTOMREQUEST, 'MKCOL')
self.curl.setopt(pycurl.WRITEFUNCTION, lambda x: None)
for x in miscutils.get_list_directories([m.group(2)]):
Expand Down

0 comments on commit 96ab2a8

Please sign in to comment.