# Gmail atom feed

**URL:** <https://www.ruby-forum.com/t/gmail-atom-feed/225949>\
**Category:** Ruby\
**Created:** [May 22, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949 "2007-05-22T17:01:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/1 "2007-05-22T17:01:41Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 5:27pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/2 "2007-05-22T17:27:45Z")

</div>

On Wed, May 23, 2007 at 12:01:14AM +0900, Fred P. wrote:

> ```
> h = Net::HTTP.new(@url.host,@url.port)
> 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.

---

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/3 "2007-05-22T17:40:47Z")

</div>

I only have:  
ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb

in my net/ directory

---

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 7:26pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/4 "2007-05-22T19:26:07Z")

</div>

On Wed, May 23, 2007 at 12:39:52AM +0900, Fred P. 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)

---

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 7:39pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/5 "2007-05-22T19:39:08Z")

</div>

Thanks, it’s working perfectly now.

---

<div class="post-metadata">

**Author:** ![no137b](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@no137b](https://www.ruby-forum.com/u/no137b)\
**Post date:** [May 22, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/gmail-atom-feed/225949/6 "2007-05-22T20:02:12Z")

</div>

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

> 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.caboo.se/63595](http://pastie.caboo.se/63595)

That I put together from:

# #=======================================================================

# Based on the Rails stack script from RimuHosting

## #-----------------------------------------------------------------------

# Written by Peter over at [RimuHosting.com](http://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/knowledgebase/linux/](http://bliki.rimuhosting.com/space/knowledgebase/linux/)

miscapplications/ruby+on+rails

# 

# the latest version of this script is typically found at http://

# [downloads.rimuhosting.com/miscproj/rails.sh](http://downloads.rimuhosting.com/miscproj/rails.sh) #=======================================================================

# and the blog post by Mike M.:

# "compiling ruby 1.8.5 w/ openssl on Debian (Etch/testing) and

## FreeBSD in $HOME" #-----------------------------------------------------------------------

# #[http://blog.mondragon.cc/articles/2007/02/03/compiling-ruby-1-8-5-w-](http://blog.mondragon.cc/articles/2007/02/03/compiling-ruby-1-8-5-w-) 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 M.'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 B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
