lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev Patch to 2.8rel2 to accept all cookies


From: pk
Subject: lynx-dev Patch to 2.8rel2 to accept all cookies
Date: Thu, 9 Jul 1998 00:01:17 -0700

Hi there --

I was starting to get tired of always having to hit 'A' to tell lynx to
accept cookies that it was offered, so I made up this patch to 2.8rel2 to
automatically accept all cookies if a commandline switch is given, or an
option is set in the lynx.cfg or .lynxrc file. If EAT_ALL_COOKIES is set
to TRUE, or -eat_all_cookies is specified on the commandline, they'll all
be accepted.

This is my first time playing around with lynx, so I probably didn't do
everything exactly the preferred way, but it seems to work for me and a
couple other people.

Patch follows:


diff -urh lynx2-8/src/HTAlert.c lynx2-8.bri/src/HTAlert.c
--- lynx2-8/src/HTAlert.c       Tue Nov  4 14:55:08 1997
+++ lynx2-8.bri/src/HTAlert.c   Wed Jul  8 12:57:51 1998
@@ -377,11 +377,17 @@
         namelen = (int)(percentage*(float)namelen);
         valuelen = (int)(percentage*(float)valuelen);
     }
-    sprintf(message, ADVANCED_COOKIE_CONFIRMATION,
-           server, namelen, name, valuelen, value);
-    _statusline(message);
+    if(!LYEatAllCookies) {
+        sprintf(message, ADVANCED_COOKIE_CONFIRMATION,
+                server, namelen, name, valuelen, value);
+        _statusline(message);
+    } 
     while (1) {
-       ch = LYgetch();
+        if(!LYEatAllCookies) {
+           ch = LYgetch();
+        } else {
+            ch = 'A';
+        } 
 #ifdef VMS
        if (HadVMSInterrupt) {
            HadVMSInterrupt = FALSE;
diff -urh lynx2-8/src/LYGlobalDefs.h lynx2-8.bri/src/LYGlobalDefs.h
--- lynx2-8/src/LYGlobalDefs.h  Fri Feb 13 05:53:42 1998
+++ lynx2-8.bri/src/LYGlobalDefs.h      Wed Jul  8 12:41:32 1998
@@ -297,6 +297,7 @@
 extern int LYStatusLine;               /* Line for statusline() or -1   */
 extern BOOLEAN LYCollapseBRs;          /* Collapse serial BRs?          */
 extern BOOLEAN LYSetCookies;           /* Process Set-Cookie headers?   */
+extern BOOLEAN LYEatAllCookies;         /* accept ALL cookies?          */
 extern char *XLoadImageCommand;                /* Default image viewer for X   
 */
 #ifdef USE_EXTERNALS
 extern BOOLEAN no_externals; /* don't allow the use of externals */
diff -urh lynx2-8/src/LYMain.c lynx2-8.bri/src/LYMain.c
--- lynx2-8/src/LYMain.c        Fri Feb 27 10:25:07 1998
+++ lynx2-8.bri/src/LYMain.c    Wed Jul  8 17:37:36 1998
@@ -349,6 +349,7 @@
 PUBLIC int LYStatusLine = -1;           /* Line for statusline() if > -1 */
 PUBLIC BOOLEAN LYCollapseBRs = COLLAPSE_BR_TAGS;  /* Collapse serial BRs? */
 PUBLIC BOOLEAN LYSetCookies = SET_COOKIES; /* Process Set-Cookie headers? */
+PUBLIC BOOLEAN LYEatAllCookies = EAT_ALL_COOKIES; /* take all 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? */
@@ -2022,7 +2023,14 @@
     break;
 
     case 'e':
-    if (strncmp(argv[0], "-editor", 7) == 0) {
+
+    if (strncmp(argv[0], "-eat_all_cookies", 16) == 0) {
+       if (LYEatAllCookies)
+           LYEatAllCookies = FALSE;
+       else
+           LYEatAllCookies = TRUE; 
+
+    } else if (strncmp(argv[0], "-editor", 7) == 0) {
        if (nextarg)
            StrAllocCopy(editor,cp);
        system_editor = TRUE;
@@ -2717,6 +2725,7 @@
 ,"                     with -dump, format output as with -traversal, but to 
stdout"
 ,"    -display=DISPLAY set the display variable for X execed programs"
 ,"    -dump            dump the first file to stdout and exit"
+,"    -eat_all_cookies accepts all cookies"    
 ,"    -editor=EDITOR   enable edit mode with specified editor"
 ,"    -emacskeys       enable emacs-like key movement"
 ,"    -enable_scrollback  toggles compatibility with comm programs' scrollback"
diff -urh lynx2-8/src/LYReadCFG.c lynx2-8.bri/src/LYReadCFG.c
--- lynx2-8/src/LYReadCFG.c     Fri Feb 27 10:25:07 1998
+++ lynx2-8.bri/src/LYReadCFG.c Wed Jul  8 12:47:36 1998
@@ -660,7 +660,10 @@
        break;
 
        case 'E':
-       if (!strncasecomp(buffer, "EMACS_KEYS_ALWAYS_ON:", 21)) {
+       if (!strncasecomp(buffer, "EAT_ALL_COOKIES:", 16)) {
+           LYEatAllCookies = is_true(buffer+16);  
+
+        } else if (!strncasecomp(buffer, "EMACS_KEYS_ALWAYS_ON:", 21)) {
            emacs_keys = is_true(buffer+21);
 
        } else if (!strncasecomp(buffer, "ENABLE_SCROLLBACK:", 18)) {
diff -urh lynx2-8/src/LYrcFile.c lynx2-8.bri/src/LYrcFile.c
--- lynx2-8/src/LYrcFile.c      Wed Jan 28 02:39:47 1998
+++ lynx2-8.bri/src/LYrcFile.c  Wed Jul  8 12:53:48 1998
@@ -446,6 +446,25 @@
            }
 #endif /* DIRED_SUPPORT */
 
+        /*
+         * eat all cookies? i think it should work user-by-user.
+         *  -BJP
+         */
+
+        } else if ((cp = LYstrstr(line_buffer, "eat_all_cookies")) != NULL &&
+                   cp-line_buffer < number_sign) {
+            if((cp2 = (char *)strchr(cp,'=')) != NULL)
+                cp = cp2 + 1;
+            while (isspace(*cp))
+                cp++; /* get rid of spaces */
+            if (LYstrstr(cp,"TRUE") != NULL) {
+                LYEatAllCookies = TRUE;
+            } else {
+                LYEatAllCookies = FALSE;
+            }
+        /* BJP */
+
+
        /*
         *  User mode.
         */
diff -urh lynx2-8/userdefs.h lynx2-8.bri/userdefs.h
--- lynx2-8/userdefs.h  Tue Mar 10 04:07:58 1998
+++ lynx2-8.bri/userdefs.h      Wed Jul  8 17:40:04 1998
@@ -841,6 +841,15 @@
  */
 #define SET_COOKIES TRUE
 
+/*******************************
+ * If EAT_ALL_COOKIES is set TRUE, and SET_COOKIES is TRUE, lynx will accept
+ * all cookies.
+ *
+ * The default defined here can be changed in lynx.cfg, and .lynxrc, or
+ * specified with the -eat_all_cookies command line switch.
+ */
+#define EAT_ALL_COOKIES FALSE
+
 
 /****************************************************************
  *   Section 2.   Things that you probably want to change or review


<END PATCH>

-brian j. pardy

-- 
Stay away from hurricanes for a while.
Paul Revere was a tattle-tale.

reply via email to

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