Skip to content
Snippets Groups Projects
Commit 6d50313f authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[httpupload] Dont allow insecure transport

parent 0393f8d2
No related branches found
No related tags found
1 merge request!41Improved error messages
......@@ -19,6 +19,7 @@ import threading
import ssl
import urllib
from urllib.request import Request, urlopen
from urllib.parse import urlparse
import io
import mimetypes
import logging
......@@ -269,6 +270,16 @@ class Base(object):
transient_for=file.control.parent_win.window)
return
try:
if (urlparse(file.put).scheme != 'https' or
urlparse(file.get).scheme != 'https'):
raise UnsecureTransportError
except UnsecureTransportError as error:
file.progress.close_dialog()
ErrorDialog(_('Error'), str(error),
transient_for=file.control.parent_win.window)
return
try:
file.stream = StreamFileWithProgress(file)
except Exception as exc:
......@@ -444,3 +455,7 @@ class ProgressWindow:
class UploadAbortedException(Exception):
def __str__(self):
return "Upload Aborted"
class UnsecureTransportError(Exception):
def __str__(self):
return 'Server returned unsecure transport'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment