lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [2.8.1dev24] patch - set cookiefile from rcfile/commandline


From: brian j. pardy
Subject: lynx-dev [2.8.1dev24] patch - set cookiefile from rcfile/commandline
Date: Tue, 1 Sep 1998 22:28:41 -0700

address@hidden wrote:
> > [make cookie file settable in .lynxrc]
> I expect someone will make a patch...

This patch, against a clean dev24, will:

* add "-cookie_file=" commandline option to specify cookie file 
* add "cookie_file=" option to .lynxrc
* add "cookie_file:" option to lynx.cfg
* change default cookie file to "Home_Dir()/cookies" (or sys$login:cookies 
  for VMS, which may or may not work, DOS also needs to be checked)

These are all #ifdef'd off with the EXP_PERSISTENT_COOKIES define.

Also, as a small cleanup, it removes the line from the TODO in LYCookie.c
about creating a means to specify "always allow" and "never allow" by
domain.

diff -cr 2.8.1dev.24/src/LYCookie.c 2.8.1dev.24.bri/src/LYCookie.c
*** 2.8.1dev.24/src/LYCookie.c  Sat Aug 29 16:22:40 1998
--- 2.8.1dev.24.bri/src/LYCookie.c      Tue Sep  1 21:12:13 1998
***************
*** 17,24 ****
  **            - FM                                    1997-08-02
  **
  **  TO DO: (roughly in order of decreasing priority)
-       * A means to specify "always allow" and "never allow" domains via
-       a configuration file is needed.
        * Hex escaping isn't considered at all.  Any semi-colons, commas,
        or spaces actually in cookie names or values (i.e., not serving
        as punctuation for the overall Set-Cookie value) should be hex
--- 17,22 ----
***************
*** 1908,1921 ****
  
  /* rjp - experimental persistent cookie support */
  PRIVATE void LYStoreCookies ARGS1 (
!       CONST char *,   cookie_fileX)
  {
      char buf[1024];
      HTList *dl, *cl;
      domain_entry *de;
      cookie *co;
      FILE *cookie_handle;
-     char *cookie_file = "cookies";
  #ifdef VMS
      extern BOOLEAN HadVMSInterrupt;
  #endif /* VMS */
--- 1906,1918 ----
  
  /* rjp - experimental persistent cookie support */
  PRIVATE void LYStoreCookies ARGS1 (
!       CONST char *,   cookie_file)
  {
      char buf[1024];
      HTList *dl, *cl;
      domain_entry *de;
      cookie *co;
      FILE *cookie_handle;
  #ifdef VMS
      extern BOOLEAN HadVMSInterrupt;
  #endif /* VMS */
***************
*** 1929,1935 ****
        return;
      }
  
!     cookie_handle = fopen(cookie_file, "w+");
      for (dl = domain_list; dl != NULL; dl = dl->next) {
        de = dl->object;
        if (de == NULL)
--- 1926,1932 ----
        return;
      }
  
!     cookie_handle = fopen(cookie_file, "w+"); 
      for (dl = domain_list; dl != NULL; dl = dl->next) {
        de = dl->object;
        if (de == NULL)
***************
*** 2016,2022 ****
  
  #ifdef EXP_PERSISTENT_COOKIES
      /* rjp - this can go here for now */
!     LYStoreCookies ("j");
  #endif
  
      /*
--- 2013,2019 ----
  
  #ifdef EXP_PERSISTENT_COOKIES
      /* rjp - this can go here for now */
!     LYStoreCookies (LYCookieFile);
  #endif
  
      /*
diff -cr 2.8.1dev.24/src/LYGlobalDefs.h 2.8.1dev.24.bri/src/LYGlobalDefs.h
*** 2.8.1dev.24/src/LYGlobalDefs.h      Sat Aug 29 16:22:40 1998
--- 2.8.1dev.24.bri/src/LYGlobalDefs.h  Tue Sep  1 22:12:35 1998
***************
*** 302,310 ****
  extern int LYStatusLine;              /* Line for statusline() or -1   */
  extern BOOLEAN LYCollapseBRs;         /* Collapse serial BRs?          */
  extern BOOLEAN LYSetCookies;          /* Process Set-Cookie headers?   */
! extern BOOLEAN LYAcceptAllCookies;      /* accept ALL cookies?          */
  extern char *LYCookieAcceptDomains;     /* domains to accept all cookies */
  extern char *LYCookieRejectDomains;     /* domains to reject all cookies */
  extern char *XLoadImageCommand;               /* Default image viewer for X   
 */
  #ifdef USE_EXTERNALS
  extern BOOLEAN no_externals;          /* don't allow the use of externals */
--- 302,313 ----
  extern int LYStatusLine;              /* Line for statusline() or -1   */
  extern BOOLEAN LYCollapseBRs;         /* Collapse serial BRs?          */
  extern BOOLEAN LYSetCookies;          /* Process Set-Cookie headers?   */
! extern BOOLEAN LYAcceptAllCookies;      /* accept ALL cookies?           */
  extern char *LYCookieAcceptDomains;     /* domains to accept all cookies */
  extern char *LYCookieRejectDomains;     /* domains to reject all cookies */
+ #ifdef EXP_PERSISTENT_COOKIES
+ extern char *LYCookieFile;              /* file to store cookies in      */
+ #endif /* EXP_PERSISTENT_COOKIES */
  extern char *XLoadImageCommand;               /* Default image viewer for X   
 */
  #ifdef USE_EXTERNALS
  extern BOOLEAN no_externals;          /* don't allow the use of externals */
diff -cr 2.8.1dev.24/src/LYMain.c 2.8.1dev.24.bri/src/LYMain.c
*** 2.8.1dev.24/src/LYMain.c    Fri Aug 21 06:30:14 1998
--- 2.8.1dev.24.bri/src/LYMain.c        Tue Sep  1 22:22:08 1998
***************
*** 337,342 ****
--- 337,345 ----
  PUBLIC BOOLEAN LYAcceptAllCookies = ACCEPT_ALL_COOKIES; /* take all cookies? 
*/
  PUBLIC char *LYCookieAcceptDomains = NULL; /* domains to accept all cookies */
  PUBLIC char *LYCookieRejectDomains = NULL; /* domains to reject all cookies */
+ #ifdef EXP_PERSISTENT_COOKIES
+ PUBLIC char *LYCookieFile = NULL;          /* default cookie file */
+ #endif /* EXP_PERSISTENT_COOKIES
  PUBLIC char *XLoadImageCommand = NULL;        /* Default image viewer for X */
  PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? 
*/
  PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */
***************
*** 1523,1529 ****
       *        Sod it, this looks like a reasonable place to load the
       *        cookies file, probably.  - RP
       */
!     LYLoadCookies("cookies"); /* add command line options! */
  #endif
  
      /*
--- 1526,1564 ----
       *        Sod it, this looks like a reasonable place to load the
       *        cookies file, probably.  - RP
       */
!     if(LYCookieFile == NULL) { 
! #ifdef VMS
!         /* I really don't know if this is going to work on VMS. Someone
!          * who knows needs to take a look. - BJP
!          */
!         StrAllocCopy(LYCookieFile, "sys$login:cookies");
! #else
!         StrAllocCopy(LYCookieFile, Home_Dir());
!         StrAllocCat(LYCookieFile, "/cookies");
! #endif /* VMS */
!     } else {
!         if ((cp = strchr(LYCookieFile, '~'))) {
!             char *temp = NULL;
!             int len;
!             *(cp++) = '\0';
!             StrAllocCopy(temp, cp);
!             if (((len = strlen(temp)) > 0) && temp[len-1] == '/')
!                 temp[len-1] = '\0';
! #ifdef DOSPATH
!             StrAllocCopy(LYCookieFile, HTDOS_wwwName((char *)Home_Dir()));
! #else
! #ifdef VMS
!             StrAllocCopy(LYCookieFile, HTVMS_wwwName((char *)Home_Dir()));
! #else
!             StrAllocCopy(LYCookieFile, Home_Dir());
! #endif /* VMS */
! #endif /* DOSPATH */
! 
!             StrAllocCat(LYCookieFile, temp);
!             FREE(temp);
!         }
!     }
!     LYLoadCookies(LYCookieFile); 
  #endif
  
      /*
***************
*** 2608,2613 ****
--- 2643,2654 ----
        "cookies",      TOGGLE_ARG,             &LYSetCookies,
        "toggles handling of Set-Cookie headers"
     ),
+ #ifdef EXP_PERSISTENT_COOKIES
+    PARSE_STR(
+       "cookie_file",    LYSTRING_ARG,           &LYCookieFile,
+       "=FILENAME\nspecifies a file to use to store cookies"
+    ),
+ #endif /* EXP_PERSISTENT_COOKIES */
  #ifndef VMS
     PARSE_SET(
        "core",         TOGGLE_ARG,             &LYNoCore,
diff -cr 2.8.1dev.24/src/LYReadCFG.c 2.8.1dev.24.bri/src/LYReadCFG.c
*** 2.8.1dev.24/src/LYReadCFG.c Sat Aug 15 14:57:56 1998
--- 2.8.1dev.24.bri/src/LYReadCFG.c     Tue Sep  1 22:18:30 1998
***************
*** 807,812 ****
--- 807,815 ----
       PARSE_FUN("color", CONF_FUN, color_fun),
  #endif
       PARSE_STR("cookie_accept_domains", CONF_STR, LYCookieAcceptDomains),
+ #ifdef EXP_PERSISTENT_COOKIES
+      PARSE_STR("cookie_file", CONF_STR, LYCookieFile),
+ #endif /* EXP_PERSISTENT_COOKIES */
       PARSE_STR("cookie_reject_domains", CONF_STR, LYCookieRejectDomains),
       PARSE_ENV("cso_proxy", CONF_ENV, 0 ),
  #ifdef VMS
diff -cr 2.8.1dev.24/src/LYrcFile.c 2.8.1dev.24.bri/src/LYrcFile.c
*** 2.8.1dev.24/src/LYrcFile.c  Tue Sep  1 19:00:43 1998
--- 2.8.1dev.24.bri/src/LYrcFile.c      Tue Sep  1 22:18:10 1998
***************
*** 465,470 ****
--- 465,483 ----
                cp++; /* get rid of spaces */
            cookie_add_rejectlist(cp);
  
+ #ifdef EXP_PERSISTENT_COOKIES
+         /*
+          * File to store cookies in.
+          */
+         } else if ((cp = LYstrstr(line_buffer, "cookie_file"))
+                 != NULL && cp-line_buffer < number_sign) {
+             if((cp2 = (char *)strchr(cp,'=')) != NULL)
+                 cp = cp2 + 1;
+             while (isspace(*cp))
+                 cp++; /* get rid of spaces */
+ 
+             StrAllocCopy(LYCookieFile, cp);
+ #endif /* EXP_PERSISTENT_COOKIES */
  
        /*
         *  User mode.

-- 
Five is a sufficiently close approximation to infinity.
                -- Robert Firth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]