I need to simulate a single web browser session across visits
to multiple URL's, some of which I do not know until I have processed
the results of some of the first URL fetches.  In particular, the web
site that I need to access sets some non-permanent cookies and checks
them later.  pavuk (a program similar to wget) supports this, but I
prefer wget's more describe program name and command syntax.  So,
I have implemented an option to support the saving of temporary
cookies (via "--execute=tempcookies=1").  I can add a direct
command line option if desired.  Please incorporate this into
wget or let me know what I need to do to get it integrated into
wget.  Thanks in advance.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
[EMAIL PROTECTED]     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."
diff -r -u wget-1.7/doc/wget.texi wget/doc/wget.texi
--- wget-1.7/doc/wget.texi      Mon Jun  4 04:23:23 2001
+++ wget/doc/wget.texi  Mon Jun 11 20:02:31 2001
@@ -2139,6 +2139,13 @@
 @item span_hosts = on/off
 Same as @samp{-H}.
 
+@item tempcookies = on/off
+This option is only releveant if save_cookies is specified.   Normally,
+save_cookies will only cause cookies that were tagged by the web server
+as "permanent" to be saved.  If tempcookies is specified, then all
+cookies are saved.  This is helpful in using multiple invocations of
+wget to simulate a single browser session.
+
 @item timeout = @var{n}
 Set timeout value---the same as @samp{-T}.
 
diff -r -u wget-1.7/src/cookies.c wget/src/cookies.c
--- wget-1.7/src/cookies.c      Sun May 27 12:34:56 2001
+++ wget/src/cookies.c  Mon Jun 11 19:50:09 2001
@@ -1315,7 +1315,7 @@
   struct cookie *chain = (struct cookie *)value;
   for (; chain; chain = chain->next)
     {
-      if (!chain->permanent)
+      if (!chain->permanent && !opt.temp_cookies)
        continue;
       if (chain->expiry_time < cookies_now)
        continue;
diff -r -u wget-1.7/src/init.c wget/src/init.c
--- wget-1.7/src/init.c Sun May 27 12:35:04 2001
+++ wget/src/init.c     Mon Jun 11 19:36:42 2001
@@ -176,6 +176,7 @@
   { "sslcertfile",     &opt.sslcertfile,       cmd_file },
   { "sslcertkey",      &opt.sslcertkey,        cmd_file },
 #endif /* HAVE_SSL */
+  { "tempcookies",     &opt.temp_cookies,      cmd_boolean },
   { "timeout",         &opt.timeout,           cmd_time },
   { "timestamping",    &opt.timestamping,      cmd_boolean },
   { "tries",           &opt.ntry,              cmd_number_inf },
diff -r -u wget-1.7/src/options.h wget/src/options.h
--- wget-1.7/src/options.h      Sun May 27 12:35:08 2001
+++ wget/src/options.h  Mon Jun 11 19:36:12 2001
@@ -162,6 +162,7 @@
 #endif /* HAVE_SSL */
 
   int   cookies;
+  int  temp_cookies;
   char *cookies_input;
   char *cookies_output;
 };

Reply via email to