summaryrefslogtreecommitdiff
path: root/lib/uri
AgeCommit message (Collapse)Author
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-04-25[DOC] Fix capitallizing [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25common.rb: unused constantnobu
* lib/uri/common.rb (URI::HTML5ASCIIINCOMPAT): remove the constant which has been unused since r40460, and wrong since r49069 due to the operator precedence. [ruby-core:86678] [Bug #14711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23[DOC] URI::Generic#port returns Integer [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21Improve docs for URI librarystomar
* lib/uri/generic.rb: [DOC] fix invalid example code to make it syntax highlighted; drop unnecessary `puts', `p'; adapt to current inspect format without Object id; do not display unnecessary return values in examples; fix or prevent unintended description lists; fix broken RDoc; fix grammar and typos. * lib/uri.rb: ditto. * lib/uri/common.rb: ditto. * lib/uri/file.rb: ditto. * lib/uri/ftp.rb: ditto. * lib/uri/http.rb: ditto. * lib/uri/ldap.rb: ditto. * lib/uri/mailto.rb: ditto. * lib/uri/rfc2396_parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/generic.rb: fix error in docs for URI::Generic#opaquestomar
* lib/uri/generic.rb: [DOC] fix description of URI::Generic#opaque, and add an example. According to RFC2396, opaque path components do not use the slash "/" character, as opposed to hierarchical path components. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/ldap.rb: fix errors in docs for URI::LDAPstomar
* lib/uri/ldap.rb: [DOC] fix errors in example code for URI::LDAP.build and URI::LDAP.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/file.rb: fix errors in docs for URI::File.buildstomar
* lib/uri/file.rb: [DOC] fix description and example for URI::File.build; for file URIs the path component must be absolute, escaping of absolute paths is only done for URI::FTP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/file.rb: improve docs for URI::Filestomar
* lib/uri/file.rb: [DOC] fix invalid example code for URI::File.build to make it syntax highlighted; drop unnecessary `puts'; fix unintended description list; fix typos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02Fix typo on URI.hierarchical? [ci skip]nobu
* lib/uri/generic.rb (hierarchical?): [DOC] Fix typo in the description. [Fix GH-1851] From: Harry Llewelyn <advocation@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22set UTF-8 if given URI string is ASCIInaruse
Now URI is normally UTF-8, and US-ASCII URI string is considered as escaped a UTF-8 string. https://github.com/rails/rails/issues/32294 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62897 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
2018-03-15Introduce URI::File to handle file URI schemenaruse
* the default value of URI::File's authority is "" (localhost). Both nil and "localhost" is normalized to "" by default. * URI::File ignores setting userinfo and port [Feature #14035] fix https://github.com/ruby/ruby/pull/1719 fic https://github.com/ruby/ruby/pull/1832 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-08fix error if the input is mixed Unicode and percent-escapesnaruse
Reported by kivikakk (Ashe Connor) with tests and doc fix Patch based on mame and fix by naruse [Bug #14586] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-28uri/common: reduce allocations and retained objectsnormal
Thanks to Sam Saffron for this patch, it shows a nice reduction which affects many web applications: require 'memory_profiler' MemoryProfiler.report do require 'uri' end.pretty_print Before: Total allocated: 986643 bytes (15159 objects) Total retained: 246370 bytes (2532 objects) After: Total allocated: 926903 bytes (13665 objects) Total retained: 208570 bytes (1587 objects) * lib/uri/common.rb: reduce allocations and retained objects [ruby-core:85161] [Feature #14410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14Use string instead of regexpnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61225 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-12Add uplevel keyword to Kernel#warn and use itshyouhei
If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 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-10-21Use caller with length to reduce unused stringskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 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-09-11Remove commented out code of URI::HTTP.new.hsbt
[Misc #13871][ruby-core:82655] Patch by @aycabta git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-15ftp.rb: fix example format [ci skip]nobu
* lib/uri/ftp.rb: [DOC] fix format of example URLs. patched by aycabta (Code Ahss) at [ruby-core:82379]. [Bug #13814] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26* lib/uri/common.rb: [DOC] add rdoc to describesonots
URI.unescape is obsolete [ci-skip] [fix GH-1630] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-10lib/uri/generic.rb: fix typosstomar
* lib/uri/generic.rb: [DOC] fix typos in URI::Generic#== docs. Patch by Alyssa Ross (alyssais). [Fix GH-1604] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-19improve docs for URI::Genericstomar
* lib/uri/generic.rb: [DOC] expand docs for URI::Generic#normalize to clarify what normalization means here. Reported by Robert Gleeson. [ruby-core:58430] [Bug #9127] * lib/uri/generic.rb: [DOC] fix indent for correct code block detection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-23Fix typo of URI#escape [Bug #13147]naruse
patched by Steve Hill <sghill.dev@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57411 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-12-12Use URI.decode_www_form_component [Bug #10774]naruse
`parser` refered RFC2396_Parser, but it is separated. test is contributed by Dominik Menke git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22Use `&.` instead of `if` and `? :`kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-08Update comment about default constanta_matsuda
Patch by: Dave Takahashi <dtcello@gmail.com> (@dtakahas) Signed-off-by: Akira Matsuda <ronnie@dio.jp> closes #1151 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-31uri/generic.rb: Tidy up mergenobu
* lib/uri/generic.rb (URI::Generic#merge): merge merge0. [GH-1469] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-20* lib/uri/common.rb: added documentation for deprecated method.hsbt
[Misc #11960][ruby-core:72733][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11forgot to replace two occurences of ENV.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11Add an optional argument, env, to URI.find_proxy.akr
* lib/uri/generic.rb (URI.find_proxy): Add an optional argument, env. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06uri/common.rb: Update URI::WEB_ENCODINGS_ [ci skip]nobu
* lib/uri/common.rb (WEB_ENCODINGS_): split command lines and append a trailing comma. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06Update URI WEB_ENCODINGS_ hash, and fix documented cmd tonobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-30* lib/uri/http.rb: Documentation and code style imrovements.hsbt
* test/uri/test_http.rb: Added test for coverage. [fix GH-1427][ruby-core:77255][Misc #12756] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56298 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-09-12* lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`hsbt
with class method. * test/uri/test_mailto.rb: Added tests for coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-02* lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaquenaruse
only if the URI has path-rootless, not path-empty. [ruby-core:76055] [Bug #12498] patched by Chris Heisterkamp <cheister@squareup.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17Use Integer instead of Fixnum and Bignum.akr
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c, lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb, lib/rubygems/specification.rb, lib/uri/generic.rb, bootstraptest/test_eval.rb, basictest/test.rb, test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb, test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb, test/csv/test_data_converters.rb, test/date/test_date.rb, test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb, test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb, test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb, test/ruby/test_bignum.rb, test/ruby/test_case.rb, test/ruby/test_class.rb, test/ruby/test_complex.rb, test/ruby/test_enum.rb, test/ruby/test_eval.rb, test/ruby/test_iseq.rb, test/ruby/test_literal.rb, test/ruby/test_math.rb, test/ruby/test_module.rb, test/ruby/test_numeric.rb, test/ruby/test_range.rb, test/ruby/test_rational.rb, test/ruby/test_refinement.rb, test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb, test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb, test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-25fix URI::HTTP.new examplenobu
* lib/uri/http.rb (URI::HTTP#initialize): [DOC] fix example, missing mandatory arguments. [ruby-core:74540] [Bug #12215] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54257 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-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-15* lib/uri/common.rb: make code block for rdoc.hsbt
[ci skip][fix GH-1152] Patch by @Tonkpils git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14* ext/socket/lib/socket.rb: use safe navigation operator.hsbt
[fix GH-1142] Patch by @mlarraz * lib/drb/extservm.rb: ditto. * lib/net/http.rb: ditto. * lib/net/http/response.rb: ditto. * lib/scanf.rb: ditto. * lib/uri/generic.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08lib/uri/generic.rb: enable frozen_string_literalnormal
* lib/uri/generic.rb: enable frozen_string_literal (split_userinfo): remove explicit .freeze for string literals (check_path): ditto (query): ditto (fragment): ditto (to_s): ditto [ruby-core:71910] [Bug #11759] Patch-by: Colin Kelley <colindkelley@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e