[MacRuby-devel] [MacRuby] #750: Net::HTTP.get fails
MacRuby
ruby-noreply at macosforge.org
Thu Jun 17 12:11:44 PDT 2010
#750: Net::HTTP.get fails
-----------------------------------+----------------------------------------
Reporter: joecannatti@… | Owner: lsansonetti@…
Type: defect | Status: closed
Priority: blocker | Milestone: MacRuby 0.7
Component: MacRuby | Resolution: fixed
Keywords: net http |
-----------------------------------+----------------------------------------
Changes (by martinlagardette@…):
* status: new => closed
* resolution: => fixed
* milestone: MacRuby 0.6 => MacRuby 0.7
Old description:
> On certain files, a simple HTTP GET will fail with the error: "TypeError:
> can't convert nil into String". It happens on the same remote html files
> every time and I cannot determine the cause. Use this code to recreate:
>
> Net::HTTP.start('books.inomadics.com') do |http|
> req = Net::HTTP::Get.new('/iPadia/2010/June/aboutsoccer.html')
> res = http.request req
> puts res.body
> end
>
> NOTE: works fine in irb, but fails in macirb
New description:
On certain files, a simple HTTP GET will fail with the error: "TypeError:
can't convert nil into String". It happens on the same remote html files
every time and I cannot determine the cause. Use this code to recreate:
{{{
#!ruby
Net::HTTP.start('books.inomadics.com') do |http|
req = Net::HTTP::Get.new('/iPadia/2010/June/aboutsoccer.html')
res = http.request req
puts res.body
end
}}}
NOTE: works fine in irb, but fails in macirb
--
Comment:
Both example works with r4233:
{{{
$> macruby t.rb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<link href="../main_styles.css" rel="stylesheet" type="text/css" />
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
[...]
$> macruby t2.rb
<!doctype html><html><head><meta http-equiv="content-type"
content="text/html;
charset=Shift_JIS"><title>Google</title><script>window.google[...]
$>
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/750#comment:2>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list