From: Fred Phillips Date: 2007-05-23T00:39:52+09:00 Subject: Re: Gmail atom feed ------=_Part_68548_29271188.1179848392925 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I only have: ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb in my net/ directory On 22/05/07, Brian Candler wrote: > > On Wed, May 23, 2007 at 12:01:14AM +0900, Fred Phillips wrote: > > I'm trying to use basic auth to retrieve my Gmail atom feed but I keep > on > > getting "Connection reset by peer". > > > > Here's the code: > > > > $URL_FEED = 'https://mail.google.com/mail/feed/atom' > > > > def retrieve > > puts "Retrieving mail count..." > > @url = URI.parse($URL_FEED) > > h = Net::HTTP.new(@url.host,@url.port) > > begin > > unpw = [@email,@password] > > unpw = @unpw.join(':') > > z=[unpw].pack("m") > > @unpwd={'Authorization' => 'Basic ' + z } > > puts @unpwd > > resp = h.get(@url.path,@unpwd) > > @headers = "" > > resp.each {|key,val| @headers.concat("#{key}: #{val}\n")} > > puts @response.body > > rescue Net::ProtoFatalError => detail > > head = detail.data > > head.each {|key,val| puts "#{key} #{val}"} > > end > > end > > This is HTTPS. See /usr/lib/ruby/1.8/net/https.rb (or the equivalent on > your > system) for an example of how to use HTTPS URLs. > > ------=_Part_68548_29271188.1179848392925--