chansen / p5-http-tiny

Tiny HTTP Client
https://metacpan.org/dist/HTTP-Tiny
53 stars 52 forks source link

Implement can_ssl(). Fix #67 #70

Closed miyagawa closed 9 years ago

miyagawa commented 9 years ago

This implements can_ssl() method that is a public version of _assert_ssl in HTTP::Tiny::Handle, so that wrapper modules and callers can determine if an HTTPS request can be made, instead of running one and getting a runtime exception.

dagolden commented 9 years ago

I was thinking about this and hacking a bit and had this question:

Should it be specific to an object? I.e. with verify_SSL, also looking for the CA file (default or explicit)?

That might mean "can_ssl" checks if it's called as object or class method.

I was thinking to instantiate a handle (without connecting) and calling _assert_ssl and _find_CA_file on it and making sure they don't croak.

miyagawa commented 9 years ago

Should it be specific to an object? I.e. with verify_SSL, also looking for the CA file (default or explicit)?

That sounds like a good idea!

dagolden commented 9 years ago

Cherry-picked to master