Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXDRIVE-2135: Check for proxy instantiation success when using a PAC #1925

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/4.4.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release date: `2020-xx-xx`

## Core

- [NXDRIVE-2135](https://jira.nuxeo.com/browse/NXDRIVE-2135): Check for proxy instantexcexcexcexciation success when using a PAC
- [NXDRIVE-2183](https://jira.nuxeo.com/browse/NXDRIVE-2183): Use `dict.copy()` for thread safety, better atomicity speed and memory efficiency
- [NXDRIVE-2186](https://jira.nuxeo.com/browse/NXDRIVE-2186): Do not remove staled transfers at startup if the application crashed
- [NXDRIVE-2210](https://jira.nuxeo.com/browse/NXDRIVE-2210): Fix files upload with S3 direct upload enabled
Expand Down
13 changes: 8 additions & 5 deletions nxdrive/client/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,16 @@ def validate_proxy(proxy: Proxy, url: str) -> bool:
url, headers=headers, proxies=proxy.settings(url=url), verify=verify
):
return True
except OSError as exc:
except OSError:
# OSError: Could not find a suitable TLS CA certificate bundle, invalid path: ...
log.critical(f"{exc}. Ensure the 'ca_bundle' option is correct.")
return False
log.error("Ensure the 'ca_bundle' option is correct.", exc_info=True)
except AttributeError:
log.error(
"Invalid PAC URL or invalid data retrieved from the PAC URL.", exc_info=True
)
except Exception:
log.exception("Invalid proxy.")
return False
log.error("Invalid proxy.", exc_info=True)
return False


def _get_cls(category: str) -> Type[Proxy]:
Expand Down
2 changes: 1 addition & 1 deletion nxdrive/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def set_log_level(self, value: str) -> None:
self.set_config("log_level_file", value)

def set_proxy(self, proxy: "Proxy") -> str:
log.debug(f"Changed proxy to {proxy}")
log.debug(f"Trying to change proxy to {proxy}")
for engine in self.engines.values():
if not validate_proxy(proxy, engine.server_url):
return "PROXY_INVALID"
Expand Down