ruby / net-http

Net::HTTP provides a rich library which can be used to build HTTP user-agents.
Other
97 stars 66 forks source link

fix character encoding sniffing #142

Open granth opened 1 year ago

granth commented 1 year ago

This fixes two bugs I found when force_response_body_encoding (#17) is enabled.

  1. scanning_meta only checks the first meta element
  2. an attribute with no content (for example, <meta name='keywords' content=''>) breaks get_attribute

The scanning_meta change makes the code more similar to the original sniffing patch in https://bugs.ruby-lang.org/issues/2567. There may be an issue with the while and large content bodies. Maybe it should stop at <body> as well?