src/lib/cheapcgi.c 1.130

1.130 2010/01/13 23:45:56 angie
Fixed another old assumption about cookie format that user's cookie has broken: ';' was assumed to always be followed by ' ', but it might not be.
Index: src/lib/cheapcgi.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/cheapcgi.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -b -B -U 4 -r1.129 -r1.130
--- src/lib/cheapcgi.c	13 Jan 2010 22:05:53 -0000	1.129
+++ src/lib/cheapcgi.c	13 Jan 2010 23:45:56 -0000	1.130
@@ -355,15 +355,16 @@
 while (isNotEmpty(namePt))
     {
     dataPt = strchr(namePt, '=');
     if (dataPt == NULL)
-	errAbort("Mangled Cookie input string '%s' (complete cookie string: '%s')",
-		 namePt, getenv("HTTP_COOKIE"));
+	errAbort("Mangled Cookie input string: no = in '%s' (offset %d in complete cookie string: '%s')",
+		 namePt, (int)(namePt - str), getenv("HTTP_COOKIE"));
     *dataPt++ = 0;
     nextNamePt = strchr(dataPt, ';');
     if (nextNamePt != NULL)
 	{
          *nextNamePt++ = 0;
+	 if (*nextNamePt == ' ')
          nextNamePt++;
 	}
     cgiDecode(dataPt,dataPt,strlen(dataPt));
     AllocVar(el);