Skip to content

Commit

Permalink
set cafile when rebuilding the ssl context (#1223)
Browse files Browse the repository at this point in the history
* set cafile when rebuilding the ssl context

* add changelog

---------

Co-authored-by: valentin-pinkau <[email protected]>
  • Loading branch information
valentin-pinkau and valentin-pinkau authored Nov 28, 2024
1 parent 4882724 commit 33d2ba6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
### Changed

### Fixed
- Fixed unpickling of the SSL_Context to allow for a second or third pickling. [#1223](https://github.com/scalableminds/webknossos-libs/pull/1223)


## [0.16.0](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.16.0) - 2024-11-27
Expand Down
3 changes: 2 additions & 1 deletion webknossos/webknossos/dataset/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _create_sslcontext() -> ssl.SSLContext:
def _save_sslcontext(
obj: ssl.SSLContext,
) -> tuple[Callable[[Any, Any], ssl.SSLContext], tuple[ssl._SSLMethod, Optional[str]]]:
cafile = getattr(obj, "cafile")
cafile = getattr(obj, "cafile", None)
return _rebuild_sslcontext, (obj.protocol, cafile)


Expand All @@ -29,6 +29,7 @@ def _rebuild_sslcontext(
ssl_context = ssl.SSLContext(protocol)
if cafile is not None:
ssl_context.load_verify_locations(cafile=cafile)
ssl_context.cafile = cafile # type: ignore
return ssl_context


Expand Down

0 comments on commit 33d2ba6

Please sign in to comment.