r220 - /debtorrent/trunk/DebTorrent/HTTPCache.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Sat Aug 11 21:07:36 UTC 2007


Author: camrdale-guest
Date: Sat Aug 11 21:07:36 2007
New Revision: 220

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=220
Log:
Fix a bug that caused cached HTTP 404 responses to not be passed on to Apt.

Modified:
    debtorrent/trunk/DebTorrent/HTTPCache.py

Modified: debtorrent/trunk/DebTorrent/HTTPCache.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/HTTPCache.py?rev=220&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/HTTPCache.py (original)
+++ debtorrent/trunk/DebTorrent/HTTPCache.py Sat Aug 11 21:07:36 2007
@@ -190,9 +190,10 @@
         logger.info('download completed for: http://'+'/'.join(path))
         self.downloads.remove(d)
 
-        if r[0] in (200, 206):
-            file = self.get_filename(path)
-            
+        file = self.get_filename(path)
+        headers = {'Server': VERSION}
+
+        if r[0] == 200:
             # Create the directory for the new file
             new_dir = split(file)[0]
             if new_dir != '' and not exists(new_dir):
@@ -212,8 +213,10 @@
                 pass
 
         # Use the headers we want
-        mtime_string = strftime(time_format + ' GMT', gmtime(getmtime(file)))
-        headers = {'Server': VERSION, 'last-modified': mtime_string}
+        if exists(file):
+            mtime_string = strftime(time_format + ' GMT', gmtime(getmtime(file)))
+            headers['last-modified'] = mtime_string
+        
         for k, v in r[2].items():
             if k in ('last-modified', 'content-type'):
                 headers[k] = v




More information about the Debtorrent-commits mailing list