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
Only use SSL socket if kwargs are not all defaults #1639
Conversation
Thanks. I recoded it in a simpler way, but I think it should work for your purposes. Let me know if you have any problems. |
Hey Miguel, thanks for getting back to me so quickly. The simpler way doesn't quite work for a few reasons. First, on line 616 I think you might have meant to type I would also like to note than |
I corrected that mistake shortly after I committed the first attempt, are you looking at the repository as it is now? |
Oh, my bad. I was looking at commit d6bd555. The popping issue still stands, as when SSL-related kwargs are given that are
I can change my fork to feature a for loop rather than a dict comprehension so it pops the kwargs off as it goes if that would be better. That way we wouldn't need 2 dicts of SSL params. |
@JMANN240 I missed the removal of the unused arguments, sorry about that. Let me know if it is better now.
Yeah, I actually do not want to hardcode defaults from another package here. All this package cares is if you include the argument or not. The fact that a value is a default or not should not matter. Using |
Looks great, very robust now.
That makes sense. I agree that None is sufficient, just wanted to bring it to your attention. Thanks again for doing this. |
This is just a small change to accommodate for use cases in which SSL will be used in one environment but not in the other. It allows for a configuration file to dictate SSL kwargs such as keyfile and certfile are while refraining from using SSL if the kwargs given are the default values. In my particular case that led to me changing the code I was doing exactly this (see below code snippet). I am using a configuration file to specify the location of the keyfile and certfile while running my app on my production server, but on my local machine there are no SSL files needed. Previously, the code would only check to see if SSL kwargs were provided and use an SSL socket regardless of value. Now if the SSL kwargs are provided with their default values SSL is not used.