From 473ec526d29b0b040d2edd07f0a40227f4695be7 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Tue, 2 Aug 2011 22:58:38 +0200
Subject: [PATCH] Maintain the cookie value quoted if it was in the server
 response.

---
 src/ChangeLog | 6 ++++++
 src/cookies.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index bc766eb2..bd10d2f1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-02  Giuseppe Scrivano  <giuseppe@southpole.se>
+
+	* cookies.c (parse_set_cookie): If the value is quoted, do not modify
+	it.
+	Reported by: Nirgal Vourg�re <jmv_deb@nirgal.com>
+
 2011-07-29  Giuseppe Scrivano  <giuseppe@southpole.se>
 
 	* log.c (logprintf): Exit immediately on a SIGPIPE error.
diff --git a/src/cookies.c b/src/cookies.c
index 2e416886..7c3fb1cb 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -350,6 +350,13 @@ parse_set_cookie (const char *set_cookie, bool silent)
     goto error;
   if (!value.b)
     goto error;
+
+  /* If the value is quoted, do not modify it.  */
+  if (*(value.b - 1) == '"')
+    value.b--;
+  if (*value.e == '"')
+    value.e++;
+
   cookie->attr = strdupdelim (name.b, name.e);
   cookie->value = strdupdelim (value.b, value.e);