libwww-perl / LWP-Protocol-https

Provide https support for LWP::UserAgent
https://metacpan.org/pod/LWP::Protocol::https
Other
16 stars 35 forks source link

Make available the version of SSL/TLS protocol used in the connection #56

Closed jonjensen closed 4 years ago

jonjensen commented 4 years ago

I have often used the extra response headers to troubleshoot a connection, e.g.:

Client-SSL-Cipher: ECDHE-RSA-AES128-GCM-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL

but I also need to know the TLS version being used (1.2 or 1.3 in this case).

I didn't see a way to tell that, so figured adding the same kind of header for the version # would make sense.

Please let me know if there's already a way, or a better way to do this. Thanks!

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.7%) to 78.125% when pulling 35e818929eb761661bb055c7baf675c1d5e89302 on jonjensen:master into 96ba0babf2e00ffda4101b824a5daf27f0649fe1 on libwww-perl:master.

oalders commented 4 years ago

@jonjensen do you think we could add a basic unit test for this? It looks like an object that can('get_sslversion') should mostly do the trick.

jonjensen commented 4 years ago

@oalders When I went to look at this, it seemed reasonable to add these artificial response header tests to the existing live apache.org request tests, rather than mocking a socket class. So I did that to t/apache.t and pushed a new commit.

Maybe it's overengineered or something that really would be better as a unit test rather than an integration test. Let me know what you think.

oalders commented 4 years ago

@jonjensen thanks for this! The live tests can be somewhat brittle, but I think the Apache tests have historically been pretty good, so this should be fine.