[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Gmail atom feed

Brian Candler

5/22/2007 3:27:00 PM

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...
>
> 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.

2 Answers

Brian Candler

5/22/2007 5:25:00 PM

0

On Wed, May 23, 2007 at 12:39:52AM +0900, Fred Phillips wrote:
> I only have:
> ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb
>
> in my net/ directory

So, let me guess - you're using Ubuntu or Debian, right? If so you'll need

# apt-get install libopenssl-ruby1.8

If not, then please describe your system.

(Aside: This really belongs in a FAQ.
1. Always state exactly what system you're running under.
2. If running Debian/Ubuntu, Ruby is broken into shrapnel packages)


Rob Biedenharn

5/22/2007 6:01:00 PM

0


On May 22, 2007, at 1:24 PM, Brian Candler wrote:

> On Wed, May 23, 2007 at 12:39:52AM +0900, Fred Phillips wrote:
>> I only have:
>> ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb
>>
>> in my net/ directory
>
> So, let me guess - you're using Ubuntu or Debian, right? If so
> you'll need
>
> # apt-get install libopenssl-ruby1.8
>
> If not, then please describe your system.
>
> (Aside: This really belongs in a FAQ.
> 1. Always state exactly what system you're running under.
> 2. If running Debian/Ubuntu, Ruby is broken into shrapnel packages)

And if you *are* using Debian Etch (4.0), you can use this script:

http://pastie.cabo...

That I put together from:

#=======================================================================
========
# Based on the Rails stack script from RimuHosting
#-----------------------------------------------------------------------
--------
# Written by Peter over at RimuHosting.com (we provide Linux VPS
hosting services)
# Last major update: 2006-06-18
# for a bit of a blurb about this script see
# http://bliki.rimuhosting.com/space/knowledgeb...
miscapplications/ruby+on+rails
#
# the latest version of this script is typically found at http://
downloads.rimuhosting.com/miscproj/rails.sh
#=======================================================================
========
# and the blog post by Mike Mondragon:
# "compiling ruby 1.8.5 w/ openssl on Debian (Etch/testing) and
FreeBSD in $HOME"
#-----------------------------------------------------------------------
--------
#http://blog.mondragon.cc/articles/2007/02/03/compiling-rub...
openssl-on-debian-etch-testing-and-freebsd-in-home
#=======================================================================
========

If you don't have root access on your system, then take a look at the
script and make the appropriate modifications. Mike Mondragon's
article specifically addresses building in a local directory where
you don't have the permission to put things in the "global" place in
the filesystem.

-Rob

Rob Biedenharn http://agileconsult...
Rob@AgileConsultingLLC.com