diff --git a/src/_native/winhttp.cpp b/src/_native/winhttp.cpp index f4b89d9..0cf7396 100644 --- a/src/_native/winhttp.cpp +++ b/src/_native/winhttp.cpp @@ -209,8 +209,21 @@ PyObject *winhttp_urlopen(PyObject *, PyObject *args, PyObject *kwargs) { WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, - url_parts.nScheme == INTERNET_SCHEME_HTTPS ? WINHTTP_FLAG_SECURE_DEFAULTS : 0 + url_parts.nScheme == INTERNET_SCHEME_HTTPS + ? WINHTTP_FLAG_SECURE_DEFAULTS & ~WINHTTP_FLAG_ASYNC + : 0 ); + if (!hSession && GetLastError() == ERROR_INVALID_PARAMETER) { + // WINHTTP_FLAG_SECURE_DEFAULTS is not supported on older OS, so we'll + // retry without it. + hSession = WinHttpOpen( + NULL, + WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, + 0 + ); + } CHECK_WINHTTP(hSession); hConnection = WinHttpConnect( diff --git a/src/manage/config.py b/src/manage/config.py index 5b83095..31a999b 100644 --- a/src/manage/config.py +++ b/src/manage/config.py @@ -36,6 +36,11 @@ def config_bool(v): return bool(v) +def _is_valid_url(u): + from .urlutils import is_valid_url + return is_valid_url(u) + + def load_global_config(cfg, schema): try: from _native import package_get_root @@ -184,7 +189,7 @@ def resolve_config(cfg, source, relative_to, key_so_far="", schema=None, error_u v = kind(v) except (TypeError, ValueError): raise InvalidConfigurationError(source, key_so_far + k, v) - if v and "path" in opts: + if v and "path" in opts and not _is_valid_url(v): # Paths from the config file are relative to the config file. # Paths from the environment are relative to the current working dir if not from_env: @@ -196,8 +201,7 @@ def resolve_config(cfg, source, relative_to, key_so_far="", schema=None, error_u v = v.as_uri() else: v = str(v) - from .urlutils import is_valid_url - if not is_valid_url(v): + if not _is_valid_url(v): raise InvalidConfigurationError(source, key_so_far + k, v) cfg[k] = v diff --git a/src/manage/urlutils.py b/src/manage/urlutils.py index 81f40e3..dba371a 100644 --- a/src/manage/urlutils.py +++ b/src/manage/urlutils.py @@ -639,7 +639,10 @@ def __iter__(self): def on_auth(self, url): # TODO: Try looking for parent paths from URL - return self._auth[url] + try: + return self._auth[url] + except LookupError: + return None def __next__(self): if not self._url: diff --git a/src/pymanager/appxmanifest.xml b/src/pymanager/appxmanifest.xml index 3864e5e..959faec 100644 --- a/src/pymanager/appxmanifest.xml +++ b/src/pymanager/appxmanifest.xml @@ -32,7 +32,7 @@ - +