https and cookies

Krister Wicksell Eriksson <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
Hi!

I am using libwww to access pages over https. The pages contains cookies and I 
need to read them to make it work.

I can't get cookies to work when using https with libwww-5.4.0 so i have 
written a small patch to HTCookie.c which will enable cookies for https. The 
patch also allow cookies with empty values, e.g. name=;

Is there a better way to get cookies to work with https that not includes 
patching the libwww source?

Have attached my small patch against HTCookie.c.

/Krister
w3c-libwww-5.4.0-cookie.patch (text/x-diff, 1.2 KB)
--- w3c-libwww-5.4.0/Library/src/HTCookie.c	1999-07-31 03:30:16.000000000 +0200
+++ w3c-libwww-5.4.0-patch/Library/src/HTCookie.c	2003-02-19 12:29:48.000000000 +0100
@@ -250,11 +250,11 @@ PRIVATE int HTCookie_parseSetCookie (HTR
 				     char * token, char * value)
 
 {
-    char * cookie_name = HTNextField(&value);
-    char * cookie_value = HTNextField(&value);
+    char * param_pair = HTNextParam(&value);
+    char * cookie_name = HTNextField(&param_pair);
+    char * cookie_value = param_pair;
     if (cookie_name && *cookie_name && cookie_value) {
 	HTCookie * cookie = HTCookie_new();
-	char * param_pair;
 
 	HTCookie_setName(cookie, cookie_name);
 	HTCookie_setValue(cookie, cookie_value);
@@ -389,7 +389,9 @@ PUBLIC BOOL HTCookie_init (void)
 
 	/* Register the cookie before and after filters */
 	HTNet_addBefore(HTCookie_beforeFilter, "http://*", NULL, HT_FILTER_MIDDLE);
+	HTNet_addBefore(HTCookie_beforeFilter, "https://*", NULL, HT_FILTER_MIDDLE);	
 	HTNet_addAfter(HTCookie_afterFilter, "http://*", NULL, HT_ALL, HT_FILTER_MIDDLE);
+	HTNet_addAfter(HTCookie_afterFilter, "https://*", NULL, HT_ALL, HT_FILTER_MIDDLE);
 
 	baking_cookies = YES;
 	return YES;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.