From b07867ccbf6804a38e8221ba697691f4cbcb07c3 Mon Sep 17 00:00:00 2001 From: Gareth Adams Date: Mon, 17 Jun 2019 13:21:08 +0200 Subject: [PATCH] open-uri.rb: Allow HTTP check to include HTTPS As this block mentions, RFC2616/2.7.1 says: > When no explicit charset parameter is provided by the sender, media > subtypes of the "text" type are defined to have a default charset > value of "ISO-8859-1" when received via HTTP. OpenURI takes this literally - only assigning ISO-8859-1 if `@base_uri.scheme` is exactly "http" I believe this should also match the scheme "https", as RFC2818/2 says: > Conceptually, HTTP/TLS is very simple. Simply use HTTP over TLS > precisely as you would use HTTP over TCP --- lib/open-uri.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 38f074ef59..f3818a20c2 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -552,7 +552,7 @@ def charset elsif block_given? yield elsif type && %r{\Atext/} =~ type && - @base_uri && /\Ahttp\z/i =~ @base_uri.scheme + @base_uri && /\Ahttps?\z/i =~ @base_uri.scheme "iso-8859-1" # RFC2616 3.7.1 else nil -- 2.15.1