forked from extern/httpie-cli
add support for client SSL certificate and key
This commit is contained in:
parent
43cc3e7ddb
commit
14583a2efa
@ -465,6 +465,27 @@ network.add_argument(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
network.add_argument(
|
||||||
|
'--ssl-cert',
|
||||||
|
default=None,
|
||||||
|
help="""
|
||||||
|
You can specify a local cert to use as client side SSL certificate.
|
||||||
|
This file may either contain both private key and certificate or you may
|
||||||
|
specify --ssl-key separately.
|
||||||
|
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
network.add_argument(
|
||||||
|
'--ssl-key',
|
||||||
|
default=None,
|
||||||
|
help="""
|
||||||
|
The private key to use with SSL. Only needed if --ssl-cert is given and the
|
||||||
|
certificate file does not contain the private key.
|
||||||
|
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
network.add_argument(
|
network.add_argument(
|
||||||
'--timeout',
|
'--timeout',
|
||||||
type=float,
|
type=float,
|
||||||
|
@ -73,6 +73,12 @@ def get_requests_kwargs(args):
|
|||||||
auth_plugin = plugin_manager.get_auth_plugin(args.auth_type)()
|
auth_plugin = plugin_manager.get_auth_plugin(args.auth_type)()
|
||||||
credentials = auth_plugin.get_auth(args.auth.key, args.auth.value)
|
credentials = auth_plugin.get_auth(args.auth.key, args.auth.value)
|
||||||
|
|
||||||
|
cert = None
|
||||||
|
if args.ssl_cert:
|
||||||
|
cert = args.ssl_cert
|
||||||
|
if args.ssl_key:
|
||||||
|
cert = (cert, args.ssl_key)
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'stream': True,
|
'stream': True,
|
||||||
'method': args.method.lower(),
|
'method': args.method.lower(),
|
||||||
@ -83,6 +89,7 @@ def get_requests_kwargs(args):
|
|||||||
'yes': True,
|
'yes': True,
|
||||||
'no': False
|
'no': False
|
||||||
}.get(args.verify, args.verify),
|
}.get(args.verify, args.verify),
|
||||||
|
'cert': cert,
|
||||||
'timeout': args.timeout,
|
'timeout': args.timeout,
|
||||||
'auth': credentials,
|
'auth': credentials,
|
||||||
'proxies': dict((p.key, p.value) for p in args.proxy),
|
'proxies': dict((p.key, p.value) for p in args.proxy),
|
||||||
|
Loading…
Reference in New Issue
Block a user