Forum: Ruby-core [ruby-trunk - Bug #7973][Open] [doc] net/http URI passed to Net::HTTP::Post.new or Net::HTTP::Get.ne

Posted by danblack (Daniel Black) (Guest)
on 2013-02-26 21:52
(Received via mailing list)
Issue #7973 has been reported by danblack (Daniel Black).

----------------------------------------
Bug #7973: [doc] net/http URI passed to  Net::HTTP::Post.new or 
Net::HTTP::Get.new errors NoMethodError: undefined method `empty?'
https://bugs.ruby-lang.org/issues/7973

Author: danblack (Daniel Black)
Status: Open
Priority: Normal
Assignee: zzak (Zachary Scott)
Category: doc
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]



http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http... 
documents a URI object being passed to Net::HTTP::Get.new and 
Net::HTTP::Post.new a few times.

passing a URI to  Net::HTTP::Post.new or  Net::HTTP::Get.new throws a 
NoMethodError as the URI doesn't have an empty method.

(({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')
 => #<URI::HTTP:0x000000024ed098 URL:http://www.example.com/search.cgi>
1.9.3p385 :041 > req = Net::HTTP::Post.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):41:in `new'
        from (irb):41
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
1.9.3p385 :042 > req = Net::HTTP::Get.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):42:in `new'
        from (irb):42
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
}))

also fails in ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Posted by danblack (Daniel Black) (Guest)
on 2013-02-26 21:57
(Received via mailing list)
Issue #7973 has been updated by danblack (Daniel Black).


a combined uri.path and uri.query (if exists) is needed

Net::HTTP::Get.new uri.path + '?' + uri.query

I probably should also request that URI has a method to returns path + 
query as it would make a lot of sense in these examples.
----------------------------------------
Bug #7973: [doc] net/http URI passed to  Net::HTTP::Post.new or 
Net::HTTP::Get.new errors NoMethodError: undefined method `empty?'
https://bugs.ruby-lang.org/issues/7973#change-37113

Author: danblack (Daniel Black)
Status: Open
Priority: Normal
Assignee: zzak (Zachary Scott)
Category: doc
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]



http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http... 
documents a URI object being passed to Net::HTTP::Get.new and 
Net::HTTP::Post.new a few times.

passing a URI to  Net::HTTP::Post.new or  Net::HTTP::Get.new throws a 
NoMethodError as the URI doesn't have an empty method.

(({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')
 => #<URI::HTTP:0x000000024ed098 URL:http://www.example.com/search.cgi>
1.9.3p385 :041 > req = Net::HTTP::Post.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):41:in `new'
        from (irb):41
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
1.9.3p385 :042 > req = Net::HTTP::Get.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):42:in `new'
        from (irb):42
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
}))

also fails in ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Posted by drbrain (Eric Hodel) (Guest)
on 2013-02-27 00:06
(Received via mailing list)
Issue #7973 has been updated by drbrain (Eric Hodel).

Description updated
Status changed from Open to Rejected

danblack (Daniel Black) wrote:
> http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http... documents…
> […]
> (({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')

You must use ruby 2.0.0 features on ruby 2.0.0.  Please upgrade your 
ruby.
----------------------------------------
Bug #7973: [doc] net/http URI passed to  Net::HTTP::Post.new or 
Net::HTTP::Get.new errors NoMethodError: undefined method `empty?'
https://bugs.ruby-lang.org/issues/7973#change-37118

Author: danblack (Daniel Black)
Status: Rejected
Priority: Normal
Assignee: zzak (Zachary Scott)
Category: doc
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]


http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http... 
documents a URI object being passed to Net::HTTP::Get.new and 
Net::HTTP::Post.new a few times.

passing a URI to  Net::HTTP::Post.new or  Net::HTTP::Get.new throws a 
NoMethodError as the URI doesn't have an empty method.

(({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')
 => #<URI::HTTP:0x000000024ed098 URL:http://www.example.com/search.cgi>
1.9.3p385 :041 > req = Net::HTTP::Post.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):41:in `new'
        from (irb):41
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
1.9.3p385 :042 > req = Net::HTTP::Get.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):42:in `new'
        from (irb):42
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
}))

also fails in ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Posted by zzak (Zachary Scott) (Guest)
on 2013-02-27 02:39
(Received via mailing list)
Issue #7973 has been updated by zzak (Zachary Scott).


See the following documentation for 1.9.3: 
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/net/ht...

You must pass uri.path or uri.request_uri in 1.9
----------------------------------------
Bug #7973: [doc] net/http URI passed to  Net::HTTP::Post.new or 
Net::HTTP::Get.new errors NoMethodError: undefined method `empty?'
https://bugs.ruby-lang.org/issues/7973#change-37127

Author: danblack (Daniel Black)
Status: Rejected
Priority: Normal
Assignee: zzak (Zachary Scott)
Category: doc
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]


http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http... 
documents a URI object being passed to Net::HTTP::Get.new and 
Net::HTTP::Post.new a few times.

passing a URI to  Net::HTTP::Post.new or  Net::HTTP::Get.new throws a 
NoMethodError as the URI doesn't have an empty method.

(({1.9.3p385 :040 > uri = URI('http://www.example.com/search.cgi')
 => #<URI::HTTP:0x000000024ed098 URL:http://www.example.com/search.cgi>
1.9.3p385 :041 > req = Net::HTTP::Post.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):41:in `new'
        from (irb):41
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
1.9.3p385 :042 > req = Net::HTTP::Get.new(uri)
NoMethodError: undefined method `empty?' for 
#<URI::HTTP:0x000000024ed098>
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:1860:in 
`initialize'
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/http.rb:2093:in 
`initialize'
        from (irb):42:in `new'
        from (irb):42
        from 
/usr/local/redmine-new/.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in 
`<main>'
}))

also fails in ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.