bpo-991266: Fix quoting of Comment attribute of SimpleCookie (GH-6555)
(cherry picked from commit d5a2377c3d70e4143bcbee4a765b3434e21f683a)
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index 7e0259e..6e1034f 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -408,6 +408,8 @@
append("%s=%s" % (self._reserved[key], _getdate(value)))
elif key == "max-age" and isinstance(value, int):
append("%s=%d" % (self._reserved[key], value))
+ elif key == "comment" and isinstance(value, str):
+ append("%s=%s" % (self._reserved[key], _quote(value)))
elif key in self._flags:
if value:
append(str(self._reserved[key]))