Logout and Download URL Using Ruby

I am trying to load HTML content from a URL without success.

Here is the url:

http://example.com/some_string[value]

When using RestClient, I get this error:

URI::InvalidURIError: bad URI(is not URI?)

I got some help from IRI Ruby on Rails. The idea is to avoid the end of the url.

$ "http://example.com/" + CGI::escape("some_string[value]")
=> "http://example.com/some_string%5Bvalue%5D"

The generated url is not working, I get 404. However, it works in browsers.

Does anyone know how to make it work?

+3
source share
1 answer

According to the RFC URI :

Other characters are excluded because gateways and other transport agents are known to sometimes modify such characters, or they are used as delimiters.

unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

, , ,    URI.

. , , , , URL.

RestClient, , URI, , URL URI.

URL- "[" "]".

+2

Source: https://habr.com/ru/post/1792132/


All Articles