[MacRuby] #750: Net::HTTP.get fails
#750: Net::HTTP.get fails -----------------------------------+---------------------------------------- Reporter: joecannatti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.6 Component: MacRuby | Keywords: net http -----------------------------------+---------------------------------------- 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 -- Ticket URL: <http://www.macruby.org/trac/ticket/750> MacRuby <http://macruby.org/>
#750: Net::HTTP.get fails -----------------------------------+---------------------------------------- Reporter: joecannatti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.6 Component: MacRuby | Keywords: net http -----------------------------------+---------------------------------------- Comment(by watson1978@…): I think that your test code works with r4233. But if WebSite's encoding do not use a UTF-8, I think that Net::HTTP.get fails. A encoding of "www.google.co.jp" use a Shift_JIS when I accessed it with Net::HTTP. $ cat test_http.rb {{{ # -*- coding: utf-8 -*- require 'net/http' body = Net::HTTP.get('www.google.co.jp', '/') puts body }}} {{{ $ macruby test_http.rb wrong chunk size line: (Net::HTTPBadResponse) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/750#comment:1> MacRuby <http://macruby.org/>
#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/>
participants (1)
-
MacRuby