Граф коммитов

210 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA bcfe94b7f2
Revert "Revert "Promote uri to default gems""
This reverts commit fdfad90522.

  f1f27da6c4 resolved this.
2019-11-11 22:21:43 +09:00
Hiroshi SHIBATA fdfad90522
Revert "Promote uri to default gems"
This reverts commit c5b4d2a259.

  This commit affects with activation feature of RubyGems.
  [Bug #16337][ruby-core:95768]
2019-11-09 20:16:03 +09:00
Hiroshi SHIBATA c5b4d2a259
Promote uri to default gems 2019-11-09 07:32:34 +09:00
Kazuhiro NISHIYAMA d6c80876b7
Use `bind_call` instead of `bind` and `call` 2019-10-11 13:50:27 +09:00
Jeremy Evans 7909f06212 Check for invalid hex escapes in URI#query=
Fixes [Bug #11275]
2019-10-08 07:30:55 -07:00
Jeremy Evans 869e2dd8c8 Warn for URI.{,un}{escape,encode}, even if not in verbose mode
The verbose mode warning has been present for almost 10 years.
If we ever plan to remove these methods, we should make the warning
a regular deprecation warning so that people are aware.

Implements [Feature #15961]
2019-09-27 07:43:32 -07:00
Jeremy Evans a2c26fe1c6 Fix fallback in URI.encode_www_form_component to include #
Patch from Matthew Kerwin.

Fixes [Bug #14358]
2019-09-27 07:43:32 -07:00
marcandre e859e668d2 lib/*: Prefer require_relative over require.
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:33 +00:00
kazu d6bfef79a2 Update link to Email address specification
The current link leads to 404, I updated to the actual one.

[Fix GH-1929] [ci skip]
Author:    Nikolay Belov <travelerspb@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-20 08:24:55 +00:00
tenderlove 684cdb4f83 Escape debug output in InvalidURIError exceptions.
Co-authored-by: Brad Landers <brad@bradlanders.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 17:19:43 +00:00
naruse d50ecb63ec http_proxy setting should respect both parent domain and subdomain
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-05-17 07:40:01 +00:00
kazu 6509c1781c [DOC] Fix capitallizing [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25 14:00:47 +00:00
nobu 27e972854c common.rb: unused constant
* 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-25 11:56:58 +00:00
kazu 425118b898 [DOC] URI::Generic#port returns Integer [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23 12:09:21 +00:00
stomar 300b22dc22 Improve docs for URI library
* 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-21 20:04:05 +00:00
stomar 0f6a665484 lib/uri/generic.rb: fix error in docs for URI::Generic#opaque
* 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-17 19:52:10 +00:00
stomar ed510458b3 lib/uri/ldap.rb: fix errors in docs for URI::LDAP
* 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-17 19:49:51 +00:00
stomar 6a2b454b97 lib/uri/file.rb: fix errors in docs for URI::File.build
* 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-17 19:47:57 +00:00
stomar c38cb43652 lib/uri/file.rb: improve docs for URI::File
* 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-17 19:46:25 +00:00
nobu 5c7e7846b8 Fix typo on URI.hierarchical? [ci skip]
* 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-04-02 03:30:30 +00:00
naruse 234a30459c set UTF-8 if given URI string is ASCII
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-22 11:20:03 +00:00
nobu b6e2c52857 Docs and tests on URI.hierarchical?, URI.absolute?
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-21 16:03:59 +00:00
naruse 04883f12c8 Introduce URI::File to handle file URI scheme
* 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-15 16:51:31 +00:00
naruse 6db869c101 fix error if the input is mixed Unicode and percent-escapes
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-03-08 09:38:01 +00:00
normal 26b3dc4922 uri/common: reduce allocations and retained objects
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
2018-01-28 21:07:13 +00:00
naruse 84bade6aa7 Use string instead of regexp
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 06:30:22 +00:00
knu b53ec390d1 Allow empty path components in a URI [Bug #8352]
* 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-14 01:11:28 +00:00
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
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-12 11:56:25 +00:00
naruse ed48bfa5e8 Append "//" if empty host for file or postgres URI
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-12-01 15:09:41 +00:00
kazu dabdec31e4 Use caller with length to reduce unused strings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:40:03 +00:00
naruse ec7c76c446 URI::Generic: Separate no_proxy handling
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-28 10:51:31 +00:00
hsbt 21f6916b98 Remove commented out code of URI::HTTP.new.
[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-09-11 06:12:40 +00:00
nobu 16565fa2d7 ftp.rb: fix example format [ci skip]
* 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-08-15 01:05:50 +00:00
sonots 10ee38b6bc * lib/uri/common.rb: [DOC] add rdoc to describe
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-26 06:42:11 +00:00
stomar dba186ebc7 lib/uri/generic.rb: fix typos
* 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-05-10 19:03:07 +00:00
stomar 58c3935ec9 improve docs for URI::Generic
* 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-03-19 15:01:05 +00:00
naruse 6219b68fb5 Fix typo of URI#escape [Bug #13147]
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-23 17:02:08 +00:00
nobu 556e3da421 uri/generic.rb: fix exception on non-IP format
* 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
2017-01-17 12:54:35 +00:00
naruse 6c0aece53d Use URI.decode_www_form_component [Bug #10774]
`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-12-12 15:24:28 +00:00
kazu 5660bb929f Use `&.` instead of `if` and `? :`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-22 23:44:51 +00:00
a_matsuda 41cc7eaa7e Update comment about default constant
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-11-08 11:57:00 +00:00
nobu 587a24609b uri/generic.rb: Tidy up merge
* 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-31 02:08:54 +00:00
hsbt 13e474f035 * lib/uri/common.rb: added documentation for deprecated method.
[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-20 08:03:01 +00:00
akr a44f5878f2 forgot to replace two occurences of ENV.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11 16:42:05 +00:00
akr 1ab0740838 Add an optional argument, env, to URI.find_proxy.
* 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-11 07:53:56 +00:00
nobu a566bc0a38 uri/common.rb: Update URI::WEB_ENCODINGS_ [ci skip]
* 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-06 02:04:28 +00:00
nobu 48f9118253 Update URI WEB_ENCODINGS_ hash, and fix documented cmd to
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 02:01:51 +00:00
hsbt 107ba65fba * lib/uri/http.rb: Documentation and code style imrovements.
* 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-30 10:06:24 +00:00
tenderlove c2cbd5528c Don't include bad password in URI exception output
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-15 21:44:56 +00:00
hsbt 52f9d387e6 * lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
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-09-12 04:46:27 +00:00