Test: adjust proxy_server.py argument handling:

- if it is provided, don't require the certificate filename to be
  provided as an absolute path
- raise an error if the provided certificate filename does not
  point to an existing file, rather than just printing and
  ignoring (to avoid possible future diagnostic headaches)

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
This commit is contained in:
Sebastien Awwad 2018-09-26 13:10:17 -04:00
parent d69f9a2160
commit 2b97c0e59c
No known key found for this signature in database
GPG key ID: BC0C6DEDD5E5CC03

View file

@ -477,12 +477,10 @@ def test(HandlerClass=ProxyRequestHandler, ServerClass=ThreadingHTTPServer, prot
# MODIFIED: Argument added to control certificate(s) the proxy expects of
# the target server(s), and added default value.
if len(sys.argv) > 3:
if not os.path.isabs(sys.argv[3]):
print('Path for target server cert is not absolute. Ignoring.')
elif os.path.exists(sys.argv[3]):
if os.path.exists(sys.argv[3]):
TARGET_SERVER_CA_FILEPATH = sys.argv[3]
else:
print('Target server cert not found. Ignoring.')
raise Exception('Target server cert file not found: ' + sys.argv[3])
# MODIFIED: Create the target-host-specific proxy certificates directory if
# it doesn't already exist.