Skip to content

Disabling URI Normalization

Simon Arlott edited this page Aug 8, 2021 · 2 revisions

In some cases, when you encountered a URI with Unicode characters, HTTP.rb erroneously sending a faulty request that results in 404 NotFound responses, although the page looks fine in other clients; it was due to bugs in the underlying URI handling library.

You can try disabling the URI normalization feature.

By changing your request from

::HTTP.get('https://th.wiktionary.org/wiki/%E0%B8%84%E0%B8%B3')

to

::HTTP.use({
  normalize_uri: {
    normalizer: ->(uri) { HTTP::URI.parse(uri) },
  },
}).get(
  'https://th.wiktionary.org/wiki/%E0%B8%84%E0%B8%B3'
)
Clone this wiki locally