Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
HTTP.get problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ken Kaplan, post: 4475272"] ------=_NextPart_000_0004_01C583DA.799193A0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I'm new to ruby, and I've run into a problem while reading 'Programming Ruby'. The 'Basic Input and Output' chapter has this example (I've added the 'puts' statements): require 'net/http' h = Net::HTTP.new('[URL="http://www.pragmaticprogrammer.com"]www.pragmaticprogrammer.com[/URL]', 80) puts 'before get' resp, data = h.get('/index.html', nil) puts 'after get' if resp.message == "OK" data.scan(/<img src="(.*?)"/) { |x| puts x } end The above code hangs (but terminates ok with ctl-break) after 'before get', and never reaches 'after get'. There is something up with my machine, because a coworker can run this fine on his. Things I've tried : 1. 'ping [URL="http://www.pragmaticprogrammer.com"]www.pragmaticprogrammer.com[/URL] <[URL]http://www.pragmaticprogrammer.com/[/URL]> ' from the same command prompt. This works fine. 2. try with other web sites. No difference 3. uninstalled, registry cleanup (CCleaner), reboot and reinstalled ruby versions 182-14 and 182-15. No difference. 4. 'gem list ---remote' output gets to 'Updating Gem source index for::/gems.rubyforge.org' and then hangs just like the above code. 5. Turned off firewall (ZoneAlarm) and anti-spyware (Microsoft). No difference. 6. Added exception handling. No difference. Any suggestions? Ken ruby --version ruby 1.8.2 (2004-12-25) [i386-mswin32] ------=_NextPart_000_0004_01C583DA.799193A0-- [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
HTTP.get problem
Top