From: Jonas Pfenniger Date: 2007-02-14T01:00:23+09:00 Subject: [PATCH] URI::Generic#userinfo ------=_Part_76897_16845248.1171382421464 Content-Type: multipart/alternative; boundary="----=_Part_76898_19346261.1171382421464" ------=_Part_76898_19346261.1171382421464 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, the attached patch corrects the following errors : == uri's user is set to a blank string uri = URI('http://user:pass@example.org') uri.user = '' puts uri #=> "http://:pass@example.org" # should be "http://example.org" since a pass with no user doesn't make sense == uri's user is set to nil uri = URI('http://user:pass@example.org') uri.user = nil puts uri #=> NoMethodError: undefined method `+' for nil:NilClass # should be "http://example.org" == uri's password is set to a blank string uri = URI('http://user:pass@example.org') uri.password = '' puts uri #=> "http://user:@example.org" # should be "http://user@example.org" without the : == There is still a bug left : niled password uri = URI('http://user:pass@example.org') uri.password = nil puts uri #=> "http://user:pass@example.org" #should be "http://user@example.org" -- Cheers, zimbatm ------=_Part_76898_19346261.1171382421464 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello,

the attached patch corrects the following errors :

== uri's user is set to a blank string

uri = URI('http://user:pass@example.org')
uri.user = ''
puts uri #=> "http://:pass@example.org"
# should be "http://example.org" since a pass with no user doesn't make sense

== uri's user is set to nil

uri = URI('http://user:pass@example.org')
uri.user = nil
puts uri #=> NoMethodError: undefined method `+' for nil:NilClass
# should be "http://example.org"

== uri's password is set to a blank string

uri = URI('http://user:pass@example.org' )
uri.password = ''
puts uri #=> "http://user:@example.org"
# should be "http://user@example.org" without the :

== There is still a bug left : niled password

uri = URI('http://user:pass@example.org')
uri.password = nil
puts uri #=> "http://user:pass@example.org"
#should be "http://user@example.org"

--
Cheers,
  zimbatm ------=_Part_76898_19346261.1171382421464-- ------=_Part_76897_16845248.1171382421464 Content-Type: text/x-diff; name=ruby-trunk-uri-patch.diff; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_ey4iexyu Content-Disposition: attachment; filename="ruby-trunk-uri-patch.diff" SW5kZXg6IGxpYi91cmkvZ2VuZXJpYy5yYgo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBsaWIvdXJpL2dlbmVyaWMu cmIJKHLDqXZpc2lvbiAxMTcxMSkKKysrIGxpYi91cmkvZ2VuZXJpYy5yYgkoY29waWUgZGUgdHJh dmFpbCkKQEAgLTM1Niw3ICszNTYsOSBAQAogICAgIHByaXZhdGUgOmVzY2FwZV91c2VycGFzcwog CiAgICAgZGVmIHVzZXJpbmZvCi0gICAgICBpZiAhQHBhc3N3b3JkCisgICAgICBpZiBAdXNlci5u aWw/IG9yIEB1c2VyLmVtcHR5PworICAgICAgICBuaWwKKyAgICAgIGVsc2lmIEBwYXNzd29yZC5u aWw/IG9yIEBwYXNzd29yZC5lbXB0eT8KICAgICAgICAgQHVzZXIKICAgICAgIGVsc2UKICAgICAg ICAgQHVzZXIgKyAnOicgKyBAcGFzc3dvcmQK ------=_Part_76897_16845248.1171382421464--