[Rubygems-developers] Access to latest_specs.4.8.gz fails

Martin Krauskopf martin.krauskopf at gmail.com
Fri Aug 8 07:15:50 EDT 2008


 From time to time I'm getting following error:

   $ gem list -r --backtrace -V

   *** REMOTE GEMS ***

   GET 304 Not Modified: http://gems.rubyforge.org/latest_specs.4.8.gz
   ERROR:  While executing gem ... (URI::InvalidURIError)
       bad URI(is not URI?):

Found out this is due to zenspider's patch:

$ svn di -r 1806:1807
Index: lib/rubygems/remote_fetcher.rb
--- lib/rubygems/remote_fetcher.rb	(revision 1806)
+++ lib/rubygems/remote_fetcher.rb	(revision 1807)
@@ -288,6 +288,10 @@
      request.add_field 'Connection', 'keep-alive'
      request.add_field 'Keep-Alive', '30'

+    if last_modified then
+      request.add_field 'If-Modified-Since', last_modified.rfc2822
+    end
      connection = connection_for uri

      retried = false
$ svn log -r 1807
r1807 | zenspider | 2008-06-24 06:43:27 +0200 (Tue, 24 Jun 2008) |1 line

Damn right... bitch

When client sets 'If-Modified-Since' header, server might then response
with '304 Not Modified'[1] which does not contain 'Location' field in
the response header. Thus code in the RemoteFetcher#open_uri_or_path
fails since Net::HTTPNotModified is subclass of Net::HTTPRedirection and
the code tries to read the 'Location' field (which is `nil').
Seems to me that fix would be to revert the change in rev. 1807 or the
code should handle such situation and use previously gotten latest_specs
GZip in case of 304?

Any ideas?



More information about the Rubygems-developers mailing list