feat: Expose cURL's --cacert
and --capath
, along with --insecure
#60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Customizing cURL Certificate Verification
This PR builds off of #59 by @spmkone and closes #58.
Additions
stream_io.open_stream
andstream_io.CURLStreamFile
now accept an additional, optionalcertificate_handling
argument to customize the verification of SSL certificates--cacert
,--capath
, and-k
/--insecure
incurl
stream_io.CAInfo
toopen_stream
or theCURLStreamFile
constructoropen_stream("https://localhost/model.tensors", certificate_handling=CAInfo(cacert="./localhost.pem")
open_stream("https://127.0.0.1/model.tensors", certificate_handling=CAInfo(allow_untrusted=True)
certificate_handling=None
(the default) to use default certificate verification as compiled into cURLChanges from #59
--insecure
when using self-signed certificates, to encourage better security practicesallow_insecure
has been removed as a direct parameter toopen_stream
and friends, and is instead aCAInfo
optionCAInfo
configurations with self-signed certificates inmoto
open_stream
's certificate verification configurationBonus
Error messages in the
CURLStreamFile
constructor have been improved in the case where cURL terminates at startup with no other output (e.g. when SSL certificate verification fails) by querying the subprocess exit code and attaching it as supplementary information, if it is nonzero.