I have written a program to consume a Restful Service from yahoo, and
I am landed with this error.

I am using Net/HTTP library for this,

My program is as follows

require 'net/http'

APPLICATION_ID = 'XIM4jgY6YIrOoB'
YAHOO_WEB_SERVICE_SEARCH_URL = 'http://search.yahooapis.com/
WebSearchService/V1/webSearch'
query = 'world cup 2011'
results_limit = 10

proxy_addr = 'MyProxy'
proxy_port = 80
proxy_name = "MyName"
proxy_pass = "MyPassword"
path = "?appid=#{APPLICATION_ID}&query=#{URI.encode(query)}
&results=#{results_limit}"

Net::HTTP::Proxy(proxy_addr, roxy_port, proxy_name,
proxy_pass ).start( YAHOO_WEB_SERVICE_SEARCH_URL ) do |http|
  response = http.get(path)
  puts response.body
end

When I run this program, I am getting this error on which I have no
clue, but the same works with browser

/usr/local/lib/ruby/1.9.1/net/protocol.rb:135:in `read_nonblock': end
of file reached (EOFError)
        from /usr/local/lib/ruby/1.9.1/net/protocol.rb:135:in `rbuf_fill'
        from /usr/local/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
        from /usr/local/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:1191:in
`transport_request'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:1177:in `request'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:888:in `get'
        from restAPI_get_yahoo_httproxy.rb:21:in `block in <main>'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:627:in `start'
        from /usr/local/lib/ruby/1.9.1/net/http.rb:490:in `start'
        from restAPI_get_yahoo_httproxy.rb:18:in `<main>'

Please help me....

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to