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

41 Коммитов

Автор SHA1 Сообщение Дата
naruse 53fdb30e7f * lib/uri/common.rb (URI.decode_www_form): scrub string if decoded
bytes are invalid for the encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 18:58:13 +00:00
naruse 4a50d447d9 * lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
It gets encoding argument to specify the character encoding.
  It now allows loose percent encoded strings, but denies ;-separator.
  [ruby-core:53475] [Bug #8103]

* lib/uri/common.rb (URI.decode_www_form): follow current URL Standard.
  It gets encoding argument to convert before percent encode.
  Now UTF-16 strings aren't converted to UTF-8 before percent encode
  by default.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 05:27:41 +00:00
naruse 37cc18d54b * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
is not present [ruby-core:47344] [Bug #6945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-30 00:22:11 +00:00
kazu 216b833003 * test/uri/test_generic.rb (URI#test_find_proxy): add tests with empty *_proxy env variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-22 16:55:55 +00:00
kazu 89a030795a fix failures
* 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-22 16:50:49 +00:00
drbrain 9416becda4 * lib/net/http.rb: Net::HTTP now automatically detects and uses
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-07-20 01:56:21 +00:00
naruse 9381cd1184 * lib/uri/generic.rb (URI::Generic.build): duplicate args before adding
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-05-18 07:32:08 +00:00
drbrain 655738577f * lib/uri/generic.rb (module URI): URI now downcases the scheme to
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-04-11 22:11:07 +00:00
naruse 44d7233201 * lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of
Ruby 1.9; use Array#join. [Bug #5840]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-23 08:12:52 +00:00
naruse 87fe448091 * lib/uri/common.rb (URI::Parser#initialize_regexp):
use \A \z instead of ^ $. [Bug #5843]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-05 02:57:21 +00:00
naruse a83f125c31 * lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri
is path-rootless form. Bug #4759

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-03 00:32:25 +00:00
knu 733d4294fc Add some more tests for the previous fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-15 06:21:56 +00:00
knu 835693dac5 * lib/uri/generic.rb (#route_from_path): Fix a bug where
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
2011-04-15 06:13:08 +00:00
kazu 9600d9693c * test/uri/test_common.rb (TestCommon#test_encode_www_form): add
tests for r30015.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-06 10:01:42 +00:00
naruse 68b18291ac * lib/uri/common.rb (URI::Parser#initialize_pattern):
refix for restrict the pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-06 01:41:10 +00:00
nobu 839ee60687 * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion
by nested repeat operators.  [ruby-core:33464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-29 13:55:27 +00:00
akr 5fd45a4b79 * lib/uri/generic.rb (URI::Generic#hostname): new method.
(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
2010-10-06 03:30:49 +00:00
naruse c4087bcb12 * lib/uri/common.rb (URI.encode_www_form): change treatment of
undefined value in given array as latest internet draft for
  application/www-form-urlencoded.
  http://tools.ietf.org/html/draft-hoehrmann-urlencoded-01

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-30 00:48:01 +00:00
naruse 9e30f60dbf * lib/uri/common.rb (decode_www_form_component): validate.
[ruby-dev:40938]

* lib/uri/common.rb (decode_www_form): allow empty string.

* lib/uri/common.rb: fix nodoc for constant. [ruby-dev:40949]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-10 22:05:02 +00:00
naruse 8a3c3b9c95 * lib/uri/common.rb (decode_www_form): don't ignore leading '?'.
[ruby-dev:40938]

* lib/uri/common.rb (decode_www_form): check whether argument is
  valid application/x-www-form-urlencoded data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-09 11:58:20 +00:00
naruse 83c2f60b88 * lib/uri/common.rb (URI.encode_www_form_component):
convert strings of HTML5 ASCII incompatible encoding
  to UTF-8.

* lib/uri/common.rb (URI.encode_www_form_component):
  "\x83\x41" of Shift_JIS should be encoded as "%83A".
  This follows real implementations.

* lib/uri/common.rb (URI.decode_www_form_component):
  use given encoding for force_encoding. [ruby-dev:40721]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 12:36:14 +00:00
naruse f626a17d8c * lib/uri/common.rb (URI#{en,de}code_www_form_component):
renamed from URI#{en,de}code_www_component. [ruby-dev:40672]

* lib/uri/common.rb (URI#encode_www_form_component): %-encoded
  element should have always two hex.

* lib/uri/common.rb (URI#encode_www_form_component):
  better treatment for ASCII incompatible encodings and
  encodings whose lead byte may use 7bit.

* lib/uri/common.rb (URI#decode_www_form_component): add %20.

* lib/uri/common.rb (URI#decode_www_form_component): add
  result's encoding as 2nd argument.

* lib/uri/common.rb (URI#decode_www_form): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17 15:35:38 +00:00
naruse 8212cdf176 * lib/uri/common.rb (URI.encode_www_form): new method to
generate URL-encoded form data. [ruby-dev:39246]

* lib/uri/common.rb (URI.encode_www_component,
  URI.decode_www_component): new method for encode/decode
  a name/value of HTML form.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 09:00:48 +00:00
akr 37679ee584 supress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 23:12:50 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
nobu 00b4a3f9c4 * test: assert_raises has been deprecated since a long time ago.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 17:44:39 +00:00
akira 3da03397ce * lib/uri/common.rb (URI::Parser): new class.
* 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
2008-09-10 09:34:49 +00:00
akr 68543f3092 use ML ref. for assertion message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-18 07:18:56 +00:00
nobu 12b1e59f2e * generic.rb (URI::Generic::merge_path): behave as RFC 3986.
[ruby-talk:252052]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-01 03:40:08 +00:00
nobu 1f6620a6b9 * test/soap/ssl/test_ssl.rb (test_verification, test_property, test_ciphers):
use standard assert_raise.

* test/testunit/test_assertions.rb (test_assert_send): send no longer
  calls private methods.

* test/uri/test_generic.rb (test_parse): corrected path in FTP URI.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-10 04:24:07 +00:00
ryan 51c919b387 Added .document file for lib/uri.
Added mathew's patches to test_ftp.rb
Fixed a minor typo in getoptlong.rb


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-07 16:07:43 +00:00
akira c36a0f0ec0 * lib/uri/generic.rb (split_userinfo): should split ":pass" into ""
and "pass".  [ruby-dev:25667]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-23 06:08:29 +00:00
akira f461a6b8e5 * lib/uri/generic.rb (URI::Generic#merge_path):
"URI('http://www.example.com/foo/..') + './'" should return
  "URI('http://www.example.com/')".  [ruby-list:39838]
  "URI('http://www.example.com/') + './foo/bar/..'" should return
  "URI('http://www.example.com/foo/')".  [ruby-list:39844]

* test/uri/test_generic.rb (TestGeneric#test_merge): added tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-13 10:50:26 +00:00
akr b750470064 * lib/uri/common.rb (Kernel#URI): new global method for parsing URIs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-05 14:06:10 +00:00
akira f2b75020ba * lib/uri/generic.rb (URI::Generic::merge,
URI::Generic::route_from): accepts non-hierarchical URI.
  [ruby-dev:23631]

* test/uri/test_generic.rb (TestGeneric::test_route,
  TestGeneric::test_merge): added tests for above changes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-09 07:15:56 +00:00
akira 4bb0fd231e * lib/uri/generic.rb (URI::Generic::check_userinfo,
URI::Generic::check_user, URI::Generic::check_password): tests
  conflicts/depends with other components closely.

* test/uri/test_generic.rb (TestGeneric::test_set_component):
  added tets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-23 05:17:00 +00:00
akira 88695fc0ea * lib/uri/generic.rb (URI::Generic#route_from): accepts urls which
has no host-part.

* test/uri/test_generic.rb (TestGeneric::test_route): added a test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-22 11:49:20 +00:00
akira 8edab1a9b4 make case insensitive for host-part.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-09 11:07:36 +00:00
aamine c3c0468f33 * lib/uri/common.rb: new method URI.regexp. [ruby-dev:22121]
* test/uri/test_common.rb: add test for URI.regexp.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-08 04:09:02 +00:00
akira 12c8c18f09 * test/uri/*: translated RUNIT to Test::Unit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-05 06:09:26 +00:00
akira ef5883c016 * test/uri/* (6 files): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-04 04:02:16 +00:00