diff --git a/httpie/cli.py b/httpie/cli.py index 321e452e..5de07a37 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -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( '--timeout', type=float, diff --git a/httpie/client.py b/httpie/client.py index 5f519515..8514ece2 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -73,6 +73,12 @@ def get_requests_kwargs(args): auth_plugin = plugin_manager.get_auth_plugin(args.auth_type)() 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 = { 'stream': True, 'method': args.method.lower(), @@ -83,6 +89,7 @@ def get_requests_kwargs(args): 'yes': True, 'no': False }.get(args.verify, args.verify), + 'cert': cert, 'timeout': args.timeout, 'auth': credentials, 'proxies': dict((p.key, p.value) for p in args.proxy),