Exemplo n.º 1
0
 def test_rfc850_variation(self):
     """Variation of RFC-850, uses full month name and full year.
     (unknow sender)
     """
     date = 'Tuesday, 06-November-07 08:49:37 GMT'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 2
0
 def test_asctime(self):
     """ANSI C's asctime().
     """
     # Convert to 'Tue Nov  6 09:49:37 2007' in UTC+1
     date = self.expected.ctime()
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 3
0
 def decode(data):
     # Some browsers add a "length" parameter to the "If-Modified-Since"
     # header, it is an extension to the HTTP 1.0 protocol by Netscape,
     # http://www.squid-cache.org/mail-archive/squid-users/200307/0122.html
     if ';' in data:
         data = data.split(';')[0]
     return HTTPDate.decode(data)
Exemplo n.º 4
0
 def test_rfc1123_variation(self):
     """Variation of RFC-1123, uses full day name.
     (sent by Netscape 4)
     """
     date = 'Tuesday, 06 Nov 2007 08:49:37 GMT'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 5
0
 def test_timezone(self):
     """CST is GMT-6.
     """
     date = 'Tue, 06 Nov 2007 02:49:37 CST'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 6
0
 def test_rfc_2822(self):
     """RFC 2822
     """
     date = 'Tue, 06 Nov 2007 10:49:37 +0200'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 7
0
 def test_rfc850(self):
     """RFC 850
     """
     date = 'Tuesday, 06-Nov-07 08:49:37 GMT'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 8
0
 def test_rfc822(self):
     """RFC 822 is the ancestor of RFC 1123.
     """
     date = 'Tue, 06 Nov 07 08:49:37 GMT'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 9
0
 def test_rfc1123(self):
     """RFC 1123 is mainly used in HTTP.
     """
     date = 'Tue, 06 Nov 2007 08:49:37 GMT'
     date = HTTPDate.decode(date)
     self.assertEqual(date, self.expected)
Exemplo n.º 10
0
 def get_mtime(cls, reference):
     response = cls._head(reference)
     mtime = response.getheader('last-modified')
     if mtime is None:
         return None
     return HTTPDate.decode(mtime)
Exemplo n.º 11
0
 def get_mtime(cls, ref):
     mtime = cls._get_metadata(ref, 'getlastmodified')
     if mtime is not None:
         return HTTPDate.decode(mtime)
     return cls.non_existent_time
Exemplo n.º 12
0
 def get_mtime(cls, ref):
     mtime = cls._get_metadata(ref, "getlastmodified")
     if mtime is not None:
         return HTTPDate.decode(mtime)
     return cls.non_existent_time
Exemplo n.º 13
0
 def get_mtime(cls, reference):
     response = cls._head(reference)
     mtime = response.getheader('last-modified')
     if mtime is None:
         return None
     return HTTPDate.decode(mtime)