Skip to content
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

Fix ssl upgrade for regular host names #77

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/LWP/Protocol/https.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ if ( $Net::HTTPS::SSL_SOCKET_CLASS->can('start_SSL')) {
my ($self,$sock,$url) = @_;
# SNI should be passed there only if it is not an IP address.
# Details: https://github.com/libwww-perl/libwww-perl/issues/449#issuecomment-1896175509
my $host = $url->host_port() =~ m/:|^[\d.]+$/s ? undef : $url->host();
my $host = $url->host() =~ m/:|^[\d.]+$/s ? undef : $url->host();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a regression test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly I don't have much time for this right now. Also I don't know all the details on how the interaction with openssl works exactly, and in what situations this code is called (all I know is that it's used when talking to proxies, but I'm sure there's more to it).
I will keep this in the back of my head and try to come up with some tests in a quiet minute.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we've seen the same bug in Debian (in connection with an https_proxy), and the above change fixes it both for the reporter in his real enviroment and for me while testing.

That's https://bugs.debian.org/1061660 (a bit long-winded as it took me some time to figure out what the problem or the difference in my environment was -- the proxy).

While I don't claim to understand what's going on here on a deeper level and therefore can't offer any assistance in coming up with tests, I can at least confirm both the problem and that this proposed changes makes it better :)

$sock = LWP::Protocol::https::Socket->start_SSL( $sock,
SSL_verifycn_name => $url->host,
SSL_hostname => $host,
Expand Down