connection: fix bug in download_dataset

wrong URI
fix flake8
connection: add SSL option
upload_file: add SSL command-line option, update tests

Also cleanup the upload code slightly.