New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for client SSL certificate and key #197
Conversation
This file may either contain both private key and certificate or you may | ||
specify --ssl-key separately. | ||
|
||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to specify also type=FileType()
so that it fails with a user-friendly error message when the file does not exist or is not readable.
@jkbr thanks for your suggestions. I modified my changes. Instead of using Not sure, if |
@@ -44,3 +45,12 @@ def humanize_bytes(n, precision=2): | |||
break | |||
|
|||
return '%.*f %s' % (precision, n / factor, suffix) | |||
|
|||
|
|||
def existing_file(filename): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe readable_file_arg
would be a better name? (It has to both exist and be readable by the current user, and also it's tied to argparse
.)
As for the location, I think httpie.input
would be a good place.
@jkbr Thanks again for your review. I made adjustments according to your feedback. |
Great, thanks! Would you mind documenting it under HTTPS in the README please? Relevant part of python-requests docs for inspiration: http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification As for the naming, yeah maybe it could be improved. |
@jkbr would you like |
I just went ahead and renamed the parameters to |
I updated CHANGELOG and AUTHORS. Adding tests is not so trivial. Have to find a way to test SSL. |
Thanks @matleh! |
add support for client SSL certificate and key
As for the tests, it's not necessary to test the actual SSL functionality. Testing of the handling of the arguments will do. I'll look into that. |
If you mean it would be sufficent to mock out requests and check that it is called the right way - I think, I can do that. Just let me know. |
@matleh Yep, something like that would do the trick. Thanks! |
Added two parameters
--ssl-cert
and--ssl-key
which allow to pass through the client side SSL certificate and key to requests.Not sure how to test this with unittests.
Maybe naming of the parameters can be improved?