Skip to content
  • Tanaka Akira's avatar
    8f788476
    The default charset of text/* media type is UTF-8. · 8f788476
    Tanaka Akira authored
    Thanks for the patch  gareth (Gareth Adams).  [Bug #15933]
    
    -------
    
    Combines two small, but very related changes
    
    1: Treat HTTPS the same as HTTP
    
    Previously, OpenURI followed guidance in RFC2616/3.7.1:
    
    > 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.
    
    However this RFC was written before TLS was established and OpenURI was
    never updated to treat HTTPS traffic the same way. So, HTTPS documents
    received a different default to HTTP documents.
    
    This commit removes the scheme check so that all text/* documents
    processed by OpenURI are treated the same way.
    
    In theory this processing gets applied to FTP URIs too, but there's no
    mechanism in OpenURI for FTP documents to have Content-Type metadata
    appended to them, so this ends up being a no-op.
    
    2: Change default charset for text/* to UTF-8
    
    Replaces the default ISO-8859-1 charset previously defined in RFC2616 (now
    obsoleted) with a UTF-8 charset as defined in RFC6838.
    
    Fixes: https://bugs.ruby-lang.org/issues/15933
    8f788476
    The default charset of text/* media type is UTF-8.
    Tanaka Akira authored
    Thanks for the patch  gareth (Gareth Adams).  [Bug #15933]
    
    -------
    
    Combines two small, but very related changes
    
    1: Treat HTTPS the same as HTTP
    
    Previously, OpenURI followed guidance in RFC2616/3.7.1:
    
    > 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.
    
    However this RFC was written before TLS was established and OpenURI was
    never updated to treat HTTPS traffic the same way. So, HTTPS documents
    received a different default to HTTP documents.
    
    This commit removes the scheme check so that all text/* documents
    processed by OpenURI are treated the same way.
    
    In theory this processing gets applied to FTP URIs too, but there's no
    mechanism in OpenURI for FTP documents to have Content-Type metadata
    appended to them, so this ends up being a no-op.
    
    2: Change default charset for text/* to UTF-8
    
    Replaces the default ISO-8859-1 charset previously defined in RFC2616 (now
    obsoleted) with a UTF-8 charset as defined in RFC6838.
    
    Fixes: https://bugs.ruby-lang.org/issues/15933
Loading