[tor-commits] [torbirdy/master] Bug 6314: Ensure Date header uses UTC string

sukhbir at torproject.org sukhbir at torproject.org
Fri Jun 17 15:48:19 UTC 2016


commit 230ba97882424d35e12794c45db7c6715fe753f9
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Thu Jun 16 16:49:58 2016 -0700

    Bug 6314: Ensure Date header uses UTC string
---
 components/torbirdy.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/components/torbirdy.js b/components/torbirdy.js
index 84ea9c7..d4743e0 100644
--- a/components/torbirdy.js
+++ b/components/torbirdy.js
@@ -392,9 +392,11 @@ function sanitizeDateHeaders() {
     let roundedDate = new Date(date.getTime());
     // Round down to the nearest minute.
     roundedDate.setSeconds(0);
-    // Use the headeremitter's addDate function to format it properly.
-    // `this` magically refers to the headeremitter object.
-    this.addDate(roundedDate);
+    // Use the headeremitter's internal `addText` function to inject the
+    // Date header. `this` magically refers to the headeremitter object.
+    // Date.toUTCString() produces an RFC 1123-formatted date string.
+    // We replace the "GMT" symbol with "+0000" because it is preferred.
+    this.addText(roundedDate.toUTCString().replace(/GMT$/, "+0000"), false);
   });
 }
 





More information about the tor-commits mailing list