diff --git a/CHANGELOG.md b/CHANGELOG.md index 51aa8cf0a3c8c2409b032c2f6f0ed7be299d9631..6c437af7e868a4f5815076d39e835d4d7ced4821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### +* Dependency on the `requests` package. +* Dependency on the `python-dateutil` package. +* `Connection.https_proxy` option of the pycaosdb.ini and the `https_proxy` + paramter of the `configure_connection` function. See the documentation of the + latter for more information. * `apiutils.empty_diff` function that returns `True` if the diffs of two entities found with the `compare_entitis` function are empty, `False` otherwise. @@ -28,6 +33,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated ### +* `Connection.socket_proxy` option of the pycaosdb.ini. Please use + `Connection.https_proxy` instead. The deprecated option will be removed with + the next minor release. + ### Removed ### ### Fixed ### diff --git a/src/caosdb/connection/connection.py b/src/caosdb/connection/connection.py index 5a9479194525f88f70e83335af92bc4c62564e2f..7ecf0680566364f6cd4eec3952cf4f73c5df6e34 100644 --- a/src/caosdb/connection/connection.py +++ b/src/caosdb/connection/connection.py @@ -143,9 +143,6 @@ class _DefaultCaosDBServerConnection(CaosDBServerConnection): headers = {} headers["User-Agent"] = self._useragent - if path.endswith("/."): - path = path[:-1] + "%2E" - try: response = self._session.request( method=method, @@ -351,8 +348,18 @@ def configure_connection(**kwargs): An authentication token which has been issued by the CaosDB Server. Implies `password_method="auth_token"` if set. An example token string would be `["O","OneTimeAuthenticationToken","anonymous",["administration"],[],1592995200000,604800000,"3ZZ4WKRB-5I7DG2Q6-ZZE6T64P-VQ","197d0d081615c52dc18fb323c300d7be077beaad4020773bb58920b55023fa6ee49355e35754a4277b9ac525c882bcd3a22e7227ba36dfcbbdbf8f15f19d1ee9",1,30000]`. - https_proxy : str - Define a https proxy, e.g. `http://localhost:8888`. (Default: None) + https_proxy : str or bool (optional) + Define a https proxy, e.g. `http://localhost:8888`. + Define a proxy for the https connections, e.g. `http://localhost:8888`, + `socks5://localhost:8888`, or `socks4://localhost:8888`. These are + either (non-TLS) HTTP proxies, SOCKS4 proxies, or SOCKS5 proxies. HTTPS + proxies are not supported. However, the connection will be secured + using TLS in the tunneled connection nonetheless. Only the connection + to the proxy is insecure which is why it is not recommended to use HTTP + proxies when authentication against the proxy is necessary. If + unspecified, the https_proxy option of the pycaosdb.ini or the HTTPS_PROXY + environment variable are being used. Use `None` to override these + options with a no-proxy setting. (Default: unspecified) implementation : CaosDBServerConnection The class which implements the connection. (Default: diff --git a/src/caosdb/connection/utils.py b/src/caosdb/connection/utils.py index 9056bf9dea14fa2fa441fa13a5efe8e776990284..6d0b7a8b382aa114e6e3327d8b8fea09a1727979 100644 --- a/src/caosdb/connection/utils.py +++ b/src/caosdb/connection/utils.py @@ -102,13 +102,16 @@ def make_uri_path(segments=None, query=None): """ path_no_query = ("/".join([quote(segment) for segment in segments]) if segments else "") - return str(path_no_query if query is None else "?".join([ + result = str(path_no_query if query is None else "?".join([ path_no_query, "&".join([ quote(key) + "=" + (quote(query[key]) if query[key] is not None else "") for key in query ]) ])) + if result.endswith("/."): + result = result[:-1] + "%2E" + return result def quote(string): diff --git a/src/caosdb/schema-pycaosdb-ini.yml b/src/caosdb/schema-pycaosdb-ini.yml index bd795e8aafabe9915b39fae3eab3d1a84e873a43..e3ba5ead91d9e5c1c29a90e385cc87ec5cce0817 100644 --- a/src/caosdb/schema-pycaosdb-ini.yml +++ b/src/caosdb/schema-pycaosdb-ini.yml @@ -54,11 +54,11 @@ schema-pycaosdb-ini: socket_proxy: examples: ["localhost:12345"] type: string - description: You can define a socket proxy to be used. This is for the case that the server sits behind a firewall which is being tunnelled with a socket proxy (SOCKS4 or SOCKS5) (e.g. via ssh's -D option or a dedicated proxy server). + description: Deprecated. Please use https_proxy instead. https_proxy: - examples: ["https://localhost:8888"] + examples: ["http://localhost:8888", "socks5://localhost:8888", "socks4://localhost:8888"] type: string - description: Define a HTTPS Proxy. Currently, authentication against the proxy and non-TLS HTTP connections are not supported. + description: Define a proxy for the https connections. These are either (non-TLS) HTTP proxies, SOCKS4 proxies, or SOCKS5 proxies. HTTPS proxies are not supported. However, the connection will be secured using TLS in the tunneled connection nonetheless. Only the connection to the proxy is insecure which is why it is not recommended to use HTTP proxies when authentication against the proxy is necessary. Note: this option is overridden by the HTTPS_PROXY environment variable, if present. implementation: description: This option is used internally and for testing. Do not override. examples: [_DefaultCaosDBServerConnection]