summaryrefslogtreecommitdiff
path: root/test/uri/test_generic.rb
AgeCommit message (Collapse)Author
2024-01-05[ruby/uri] Make URI#to_s prepend relative path with / if there is a host or portJeremy Evans
Otherwise, the path could be considered part of the host or port. This is better than modifying the path to make it absolute when a host or port is set. We could also raise for invalid paths when a host or port is set using check_path, but that results in weird errors, and won't catch issues (such as ftp allowing a relative path). Fixes [Bug #19916] https://github.com/ruby/uri/commit/ac32aa005b
2023-06-25[ruby/uri] Fix host part in relative referece #83Nobuyoshi Nakada
In relative referece, host part can be ommitted but can not be empty. https://github.com/ruby/uri/commit/2980f0ba02
2022-10-13URI.parse should set empty string in host instead of nilNARUSE, Yui
2021-07-28Update to latest uriBenoit Daloze
* https://github.com/ruby/uri/commit/bc47bf71df2b2e9cea09d0b2684ceac7355e42a0 * To include the fix from https://github.com/ruby/uri/pull/27
2021-04-22[ruby/uri] Optimize URI#hostname and URI#hostname=Lukas Zapletal
https://github.com/ruby/uri/commit/3b7ccfd835
2020-05-06Fakes IPSocket.getaddress in the whole methodNobuyoshi Nakada
To get rid of calling `getaddrinfo`, which may keep FDs internally.
2019-08-19Make portable for standalone test-unit gem.Hiroshi SHIBATA
* It can invoke test-unit with envutil.rb * refute_match of test-unit couldn't handle String instance.
2018-05-17http_proxy setting should respect both parent domain and subdomainnaruse
URI::Generic: Respect no_proxy for both parent domain and subdomains It is now possible to add just the subdomains for proxy bypass. In a setting where the main domain needs to go through proxy while the subdomains don't, it is now possible to just add the subdomains to the no_proxy list. The assumption that subdomains and the parent domain should behave the same wrt no_proxy has been removed. eg: Adding .example.com in no_proxy would allow example.com to go through the proxy. From: Harsimran Singh Maan <maan.harry@gmail.com> fix https://github.com/ruby/ruby/pull/1748 [Bug #14345] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21Docs and tests on URI.hierarchical?, URI.absolute?nobu
Improve code coverage and clarify meaning of hierarchical based on RFC text. [Fix GH-1846] From: Xavier Riley <xavriley@hotmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14Allow empty path components in a URI [Bug #8352]knu
* generic.rb (URI::Generic#merge, URI::Generic#route_to): Fix a bug where a sequence of slashes in the path part gets collapsed to a single slash. According to the relevant RFCs and WHATWG URL Standard, empty path components are simply valid and there is no special treatment defined for them, so we just keep them as they are. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-01Append "//" if empty host for file or postgres URInaruse
https://url.spec.whatwg.org/#url-serializing > Otherwise, if url’s host is null and url’s scheme is "file", append "//" to output. URL spec doesn't says anything about postgres, but assume the same thing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-28URI::Generic: Separate no_proxy handlingnaruse
To share with Net::HTTP. see #11195 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-17uri/generic.rb: fix exception on non-IP formatnobu
* lib/uri/generic.rb (URI::Generic#find_proxy): match IP address no_proxy against resolved self IP address. [Fix GH-1513] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12fix warning: assigned but unused variablekazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12do not need to downcase twicekazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11Test URI.find_proxy using env argument.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-15Don't include bad password in URI exception outputtenderlove
We shouldn't include the bad password in the URI exception output message. Just knowing that there is a bad password is enough information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-13CIDR in no_proxynobu
* lib/uri/generic.rb (URI::Generic#find_proxy): support CIDR in no_proxy. [ruby-core:73769] [Feature#12062] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-13no_proxy with whitespaces and leading dotsnobu
* lib/uri/generic.rb (find_proxy): exclude white-spaces and allow for a leading dot in the domain name in no_proxy. [ruby-core:54542] [Feature #8317] The previous implementation wouldn't allow for white-spaces nor a leading dot in the domain name. The latter is described in the wget documentation as a valid case. By being more strict on the characters, which are counted to a domainname, we allow for white-spaces. Also, a possible leading dot will be handled gracefully. [Fix GH-285] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-13test/uri/test_generic.rb: split test_find_proxynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-13domainname no_proxy assertionsnobu
* test/uri/test_generic.rb (test_find_proxy): assertions for no_proxy of domainname. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-14* lib/uri/generic.rb (URI::Generic#to_s): change encoding tonaruse
UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com> https://github.com/ruby/ruby/pull/1188 fix GH-1188 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08test_generic.rb: fix assertionnobu
* test/uri/test_generic.rb (test_to_s): use assert_not_predicate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08test/uri/test_generic.rb (to_s): new testnormal
Ensure URI::Generic#to_s continues to return mutable strings to prevent breakage when we enable frozen string literals in future commits. [ruby-core:71820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19* lib/uri/rfc2396_parser.rb (initialize_pattern):naruse
URI::Generic.build should accept port as a string. pattern[:PORT] is not defined for long. by Dave Slutzkin <daveslutzkin@fastmail.fm> https://github.com/ruby/ruby/pull/804 fix GH-804 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-23* lib/uri/generic.rb (URI::Generic#query=): don't escape [\]^naruse
on both rfc2396 and rfc3986. [Bug #10619] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01* lib/uri/generic.rb (URI::Generic.build):naruse
use hostname= to detect and wrap IPv6 hosts. Build is accepting URI components and users may not expect that a host component needs to be wrapped with square brackets since it's not providing a URI. Note: initialize with arg_check => true does not wrap IPv6 hosts. by Joe Rafaniello <jrafanie@redhat.com> https://github.com/ruby/ruby/pull/765 fix GH-765 * test/uri/test_generic.rb: Add more tests git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-03* lib/uri/rfc3986_parser.rb (URI::RFC3986_Parser::RFC3986_URI):naruse
allow '[' and ']' for URI input (and escape). [Bug #10402] * lib/uri/generic.rb (URI#query=): escape '[', '\', and ']'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-17* lib/uri/rfc3986_parser.rb: specify a regexp for :OPAQUE; generic.rbnaruse
assumes it is present, and will refuse all values otherwise. by Matthew Draper <matthew@trebex.net> https://github.com/ruby/ruby/pull/718 fix GH-718 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-03* lib/uri/generic.rb (URI::Generic#query=): remove validation, justnaruse
escape. [Feature #2542] * lib/uri/generic.rb (URI::Generic#fragment=): ditto. * lib/uri/generic.rb (URI::Generic#check_query): removed. * lib/uri/generic.rb (URI::Generic#set_query): ditto. * lib/uri/generic.rb (URI::Generic#check_fragment): ditto. * lib/uri/generic.rb (URI::Generic#set_fragment): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23* lib/uri/generic.rb (check_port): allow strings for port= asnaruse
described in rdoc. * lib/uri/rfc3986_parser.rb (regexp): implementation detail of above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-22support RFC3986 [Feature #2542]naruse
* lib/uri/common.rb (URI::REGEXP): move to lib/uri/rfc2396_parser.rb. * lib/uri/common.rb (URI::Parser): ditto. * lib/uri/common.rb (URI.split): use RFC3986_Parser. * lib/uri/common.rb (URI.parse): ditto. * lib/uri/common.rb (URI.join): ditto. * lib/uri/common.rb (URI.extract): deprecated. * lib/uri/common.rb (URI.regexp): ditto. * lib/uri/rfc2396_parser.rb: added. * lib/uri/rfc3986_parser.rb: added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-16* test/uri/test_generic.rb: fix wrong arguments for test case.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)knu
in addition to uri + path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-13* lib/uri/generic.rb (URI::Generic.find_proxy): return nil ifnaruse
http_proxy environment variable is empty string. [ruby-core:57140] [Bug #8898] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-24* lib/uri/generic.rb (find_proxy): raise BadURIError if the URI isnaruse
a relative URI. [Bug #8645] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-22* test/uri/test_generic.rb (URI#test_find_proxy): add tests with empty ↵kazu
*_proxy env variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-22fix failureskazu
* test/uri/test_generic.rb (URI#with_env): unset proxy related env variables. [Bug #6774] * test/uri/test_generic.rb (URI#test_find_proxy): fix failures when proxy related env variables already set. [Bug #6774] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-20* lib/net/http.rb: Net::HTTP now automatically detects and usesdrbrain
proxies from the environment. A proxy may also be specified as before. Net::HTTP::Proxy still creates anonymous classes, but these classes are only used to store configuration information. When an HTTP instance is created the configuration is now copied. Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP [Feature #6546] * lib/open-uri.rb: Moved URI::Generic#find_proxy to uri/generic. * lib/uri/generic.rb: Imported find_proxy from open-uri. * test/open-uri/test_open-uri.rb: Moved proxy-discovery tests to URI. * test/uri/test_generic.rb: Imported proxy-discovery tests from open-uri. * test/net/http/test_http.rb: Added tests for proxy behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-18* lib/uri/generic.rb (URI::Generic.build): duplicate args before addingnaruse
new items. (don't change arguments) * lib/uri/generic.rb (URI::Generic.build): use URI::Generic::COMPONENT if this method is called from URI::Generic. * lib/uri/generic.rb (URI::Generic.build2): escape only if the item is a String. * lib/uri/generic.rb (URI::Generic.build2): use DEFAULT_PARSER because it doesn't have parser method. [Bug #6420] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-11* lib/uri/generic.rb (module URI): URI now downcases the scheme todrbrain
follow RFC 2396 section 3.1. [ruby-trunk - Feature #4551] * test/uri/test_generic.rb (class URI): Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-05* lib/uri/common.rb (URI::Parser#initialize_regexp):naruse
use \A \z instead of ^ $. [Bug #5843] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-15Add some more tests for the previous fix.knu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-15* lib/uri/generic.rb (#route_from_path): Fix a bug whereknu
URI('http://h/b/').route_to('http://h/b') wrongly returned './' (should be '../b'). [Bug #4476] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-06* lib/uri/generic.rb (URI::Generic#hostname): new method.akr
(URI::Generic#hostname=): ditto. * lib/open-uri.rb: use URI#hostname * lib/net/http.rb: ditto. [ruby-core:32056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06* {ext,lib,test}/**/*.rb: removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24* test: assert_raises has been deprecated since a long time ago.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-10 * lib/uri/common.rb (URI::Parser): new class.akira
* lib/uri/mailto.rb, lib/uri/generic.rb: follow the above change. * test/uri/test_parser.rb: added tests for URI::Parser. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18use ML ref. for assertion message.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e