[#18121] [Ruby 1.8.7 - Bug #405] (Open) ssl.rb:31: [BUG] Bus Error — Anonymous <redmine@...>

Issue #405 has been reported by Anonymous.

14 messages 2008/08/04

[#18130] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Brian Candler <B.Candler@...>

> Seriously though... Array.first is a noun.

10 messages 2008/08/05

[#18319] NEW Command: absolute_path() -- — "C.E. Thornton" <admin@...>

Core,

14 messages 2008/08/16
[#18321] Re: NEW Command: absolute_path() -- — Yukihiro Matsumoto <matz@...> 2008/08/18

Hi,

[#18381] [Bug #496] DRb.start_service(nil) is very slow — Hongli Lai <redmine@...>

Bug #496: DRb.start_service(nil) is very slow

11 messages 2008/08/25

[ruby-core:18387] [Bug:1.9] rubygems fails to cache spec file

From: "Yusuke ENDOH" <mame@...>
Date: 2008-08-26 16:46:29 UTC
List: ruby-core #18387
Hi,

I realized "gem update" always fetched the whole spec file
from gems.rubyforge.org even if rubygems has cache.

rubygems certainly sends If-Modified-Since field to the
server.  But the rubyforge server ignores it.
I confirmed this by using WEBrick::HTTPProxyServer.


This is because Apache, which rubyforge uses, seems to handle
If-Modified-Since field only when it is represented in GMT.
This is not a fault of rubygems, but I think it's better for
rubygems to convert last_modified in GMT.


In addition, I noticed rubygems fails to handle "304 Not
Modified" response.


$ gem update
Updating installed gems
ERROR:  While executing gem ... (URI::InvalidURIError)
    bad URI(is not URI?):


I think this is a problem of rubygems.
# users who live in GMT should know this bug, but I cannot
# find any report and complaint...  How come? :-(


Here is a patch.


Index: lib/rubygems/remote_fetcher.rb
===================================================================
--- lib/rubygems/remote_fetcher.rb	(revision 18876)
+++ lib/rubygems/remote_fetcher.rb	(working copy)
@@ -140,6 +140,7 @@

   def fetch_path(uri, mtime = nil, head = false)
     data = open_uri_or_path(uri, mtime, head)
+    return data if data.empty?
     data = Gem.gunzip data if uri.to_s =~ /gz$/ and not head
     data
   rescue FetchError
@@ -243,6 +244,8 @@
     case response
     when Net::HTTPOK then
       head ? response : response.body
+    when Net::HTTPNotModified then
+      return ""
     when Net::HTTPRedirection then
       raise FetchError.new('too many redirects', uri) if depth > 10

@@ -274,7 +277,7 @@
     request.add_field 'Keep-Alive', '30'

     if last_modified then
-      request.add_field 'If-Modified-Since', last_modified.rfc2822
+      request.add_field 'If-Modified-Since', last_modified.dup.gmtime.rfc2822
     end

     connection = connection_for uri

-- 
Yusuke ENDOH <mame@tsg.ne.jp>

In This Thread

Prev Next