I've found that WWWOFFLE still can't correctly separate multiple cookies in
a single header. (can't log on the NY-Times website)
It's not a problem when using a browser that can handle multiple cookies,
but it is at least for the version I still use.
The code is almost completely rewritten.
Here is the patch. The old code is still there, commented, for you to see
the difference.
--
Marc
--- headbody.c.marc Fri Jul 19 20:15:02 2002
+++ headbody.c Thu Aug 1 07:06:56 2002
@@ -539,8 +539,33 @@
'expires=Wdy, DD-Mon-YY HH:MM:SS GMT' and contains an embedded ','!
*/
- if(!strcmp(head->key[i],"Set-Cookie"))
+ /* Doesn't work at all. Modified by Marc Boucher, 01-aug-2002 */
+
+ if(!strcasecmp(head->key[i],"Set-Cookie")) // header also found spelled as
+"Set-cookie", using strcasecmp instead.
{
+ char *lp=head->val[i];
+
+ strcpy(p,head->key[i]); p+=strlen(head->key[i]);
+ strcpy(p,": "); p+=2;
+ while(*lp) {
+ if (*lp==',') {
+ // strcasecmp is not for string lookup. Use strstr instead
+ if (!strstr(p-20,"expires=")) { // going back 10 chars isn't enough, 20
+is OK (size of "expire" + day of week).
+ strcpy(p,"\r\n"); p+=2;
+ strcpy(p,head->key[i]); p+=strlen(head->key[i]);
+ strcpy(p,": "); p+=2;
+ lp++; // skip the ',' in the original string
+(so we can continue the loop)
+ }
+ }
+ *p++=*lp++;
+ }
+ strcpy(p,"\r\n"); p+=2;
+
+ /* End of modification by Marc Boucher.
+ Now it works. Hopefully... ;)
+ Rest of (old) code commented. */
+
+/*
char **list=split_header_list(head->val[i]),**l;
int nlist=0;
@@ -574,7 +599,7 @@
strcpy(p,"\r\n"); p+=2;
}
- free(list);
+ free(list);*/
}
else
{