]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
web: Update hashing algorithm in StaticFileHandler (#2778)
authorMike DePalatis <mike@depalatis.net>
Sat, 23 Nov 2019 19:42:56 +0000 (12:42 -0700)
committerBen Darnell <ben@bendarnell.com>
Sat, 23 Nov 2019 19:42:56 +0000 (14:42 -0500)
Addresses #2776.

tornado/test/web_test.py
tornado/web.py

index 7c1322e0b91ede9fe631def6662785b3ce2fc4ba..9e6c15bf540782e1f1a262d9f34e17840b51d34a 100644 (file)
@@ -1052,9 +1052,12 @@ class ErrorResponseTest(WebTestCase):
 
 
 class StaticFileTest(WebTestCase):
-    # The expected MD5 hash of robots.txt, used in tests that call
+    # The expected SHA-512 hash of robots.txt, used in tests that call
     # StaticFileHandler.get_version
-    robots_txt_hash = b"f71d20196d4caf35b6a670db8c70b03d"
+    robots_txt_hash = (
+        b"63a36e950e134b5217e33c763e88840c10a07d80e6057d92b9ac97508de7fb1f"
+        b"a6f0e9b7531e169657165ea764e8963399cb6d921ffe6078425aaafe54c04563"
+    )
     static_dir = os.path.join(os.path.dirname(__file__), "static")
 
     def get_handlers(self):
index 3fc99fb8d6a4cccb8b59862674e74709edc07591..a3a8f61cf3f90a3a45d0e415ab068a3c62f97b4b 100644 (file)
@@ -2822,12 +2822,12 @@ class StaticFileHandler(RequestHandler):
         """Returns a version string for the resource at the given path.
 
         This class method may be overridden by subclasses.  The
-        default implementation is a hash of the file's contents.
+        default implementation is a SHA-512 hash of the file's contents.
 
         .. versionadded:: 3.1
         """
         data = cls.get_content(abspath)
-        hasher = hashlib.md5()
+        hasher = hashlib.sha512()
         if isinstance(data, bytes):
             hasher.update(data)
         else: