[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev lynx2.8.1dev.21
From: |
brian j. pardy |
Subject: |
Re: lynx-dev lynx2.8.1dev.21 |
Date: |
Sat, 15 Aug 1998 15:50:14 -0700 |
T.E.Dickey wrote:
> 1998-08-15 (2.8.1dev.21)
Noticed my most recent patch for rcfile-based cookie handling didn't make
it in, here's a re-send (it's the same patch as against dev20, about 4
lines offset in a couple places, but looks good)...
In this patch:
* redesigned cookie_add_{accept,reject}list in LYCookie.c -- they work now
* added COOKIE_{ACCEPT,REJECT}_DOMAINS in .lynxrc handling to LYrcFile.c
* slight spacing fix in lynx.cfg
* added blurb in lynx.cfg about COOKIE_{ACCEPT,REJECT}_DOMAINS
* -accept_all_cookies on the commandline works as a toggle now
(against lynx.cfg value -- NOT against .lynxrc value)
diff -cr 2.8.1dev.21/lynx.cfg 2.8.1dev.21.bri/lynx.cfg
*** 2.8.1dev.21/lynx.cfg Thu Aug 6 17:24:13 1998
--- 2.8.1dev.21.bri/lynx.cfg Thu Aug 6 21:14:27 1998
***************
*** 758,764 ****
--- 758,775 ----
# domains with no user interaction.
# The default is defined in userdefs.h and can be overridden here,
# and/or toggled via the -accept_all_cookies command line switch.
+ #
#ACCEPT_ALL_COOKIES:FALSE
+
+ # COOKIE_ACCEPT_DOMAINS and COOKIE_REJECT_DOMAINS are comma-delimited
+ # lists of domains (with a leading '.') to automatically accept or
+ # reject all cookies from. These can also be specified in the lynxrc
+ # file, and are overridden by the ACCEPT_ALL_COOKIES parameter. If a
+ # single domain is specified in both COOKIE_ACCEPT_DOMAINS and in
+ # COOKIE_REJECT_DOMAINS, the rejection will take precedence.
+ #
+ #COOKIE_ACCEPT_DOMAINS:
+ #COOKIE_REJECT_DOMAINS:
# VMS:
#=====
diff -cr 2.8.1dev.21/src/LYCookie.c 2.8.1dev.21.bri/src/LYCookie.c
*** 2.8.1dev.21/src/LYCookie.c Thu Aug 6 17:24:14 1998
--- 2.8.1dev.21.bri/src/LYCookie.c Thu Aug 6 21:19:33 1998
***************
*** 2432,2448 ****
return(HT_LOADED);
}
/* cookie_add_acceptlist
! * is passed a comma delimited string of domains (with leading '.')
! * to add to the "always accept" list for cookies.
*/
PUBLIC void cookie_add_acceptlist ARGS1(
! char *, acceptdomains)
{
domain_entry *de = NULL;
! char **domain1 = 0;
! char **origstr = 0;
if (domain_list == NULL) {
atexit(LYCookieJar_free);
--- 2432,2456 ----
return(HT_LOADED);
}
+
/* cookie_add_acceptlist
! * is passed a string of domains (with leading '.', and comma
! * delimited) to add to the "always accept" list for cookies. -BJP
*/
PUBLIC void cookie_add_acceptlist ARGS1(
! char *, acceptstr)
{
domain_entry *de = NULL;
! domain_entry *de2 = NULL;
! HTList *hl;
! char **str = (char **)calloc(1, sizeof(acceptstr));
! char *strsmall = (char *)calloc(1, sizeof(acceptstr));
! int isexisting = FALSE;
!
! /* is this the first cookie we're handling? if so, initialize the
! * domain_list.
! */
if (domain_list == NULL) {
atexit(LYCookieJar_free);
***************
*** 2450,2495 ****
total_cookies = 0;
}
! *origstr = (char *)acceptdomains;
!
! for(; (*domain1 = LYstrsep(origstr, ",")) != NULL;) {
! if(**domain1 != '\0') {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_accept_domains");
!
! de->bv = ACCEPT_ALWAYS;
! StrAllocCopy(de->domain, *domain1);
! HTList_addObject(domain_list, de);
! }
}
! /* then one last one, cos that's how LYstrsep() works */
!
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_accept_domains");
!
! de->bv = ACCEPT_ALWAYS;
!
! StrAllocCopy(de->domain, *origstr);
! HTList_addObject(domain_list, de);
}
/* cookie_add_rejectlist
! * is passed a comma delimited string of domains (with leading '.')
! * to add to the "always reject" list for cookies.
*/
PUBLIC void cookie_add_rejectlist ARGS1(
! char *, rejectdomains)
{
domain_entry *de = NULL;
! char **domain1 = 0;
! char **origstr = 0;
if (domain_list == NULL) {
atexit(LYCookieJar_free);
--- 2458,2523 ----
total_cookies = 0;
}
! *str = acceptstr;
! for(; (strsmall = LYstrsep(str, ","));) {
! if(strsmall == NULL)
! break;
!
! /* check the list of existing cookies to see if this is a
! * re-setting of an already existing cookie -- if so, just
! * change the behavior, if not, create a new domain entry
! */
!
! for (hl = domain_list; hl != NULL; hl = hl->next) {
! de2 = (domain_entry *)hl->object;
! if ((de2 != NULL && de2->domain != NULL) &&
! !strcmp(strsmall, de2->domain)) {
! isexisting = TRUE;
! break;
! } else {
! isexisting = FALSE;
! }
! }
!
! if(!isexisting) {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_accept_domain");
!
! de->bv = ACCEPT_ALWAYS;
!
! StrAllocCopy(de->domain, strsmall);
! HTList_addObject(domain_list, de);
! } else {
! de2->bv = ACCEPT_ALWAYS;
! }
}
! FREE(str);
! FREE(strsmall);
}
+
/* cookie_add_rejectlist
! * is passed a string of domains (with leading '.', and comma
! * delimited) to add to the "always reject" list for cookies. -BJP
*/
PUBLIC void cookie_add_rejectlist ARGS1(
! char *, rejectstr)
{
domain_entry *de = NULL;
! domain_entry *de2 = NULL;
! HTList *hl;
! char **str = (char **)calloc(1, sizeof(rejectstr));
! char *strsmall = (char *)calloc(1, sizeof(rejectstr));
! int isexisting = FALSE;
!
! /* is this the first cookie we're handling? if so, initialize the
! * domain_list.
! */
if (domain_list == NULL) {
atexit(LYCookieJar_free);
***************
*** 2497,2529 ****
total_cookies = 0;
}
! *origstr = rejectdomains;
!
! for(; (*domain1 = LYstrsep(origstr, ",")) != NULL;) {
! if(**domain1 != '\0') {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_reject_domains");
!
! de->bv = REJECT_ALWAYS;
! StrAllocCopy(de->domain, *domain1);
! HTList_addObject(domain_list, de);
! }
}
! /* then one last one, cos that's how LYstrsep() works */
!
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_reject_domains");
!
! de->bv = REJECT_ALWAYS;
!
! StrAllocCopy(de->domain, *origstr);
! HTList_addObject(domain_list, de);
}
#ifdef GLOBALDEF_IS_MACRO
--- 2525,2569 ----
total_cookies = 0;
}
! *str = rejectstr;
! for(; (strsmall = LYstrsep(str, ","));) {
! if(strsmall == NULL)
! break;
!
! /* check the list of existing cookies to see if this is a
! * re-setting of an already existing cookie -- if so, just
! * change the behavior, if not, create a new domain entry
! */
!
! for (hl = domain_list; hl != NULL; hl = hl->next) {
! de2 = (domain_entry *)hl->object;
! if ((de2 != NULL && de2->domain != NULL) &&
! !strcmp(strsmall, de2->domain)) {
! isexisting = TRUE;
! break;
! } else {
! isexisting = FALSE;
! }
! }
!
! if(!isexisting) {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
!
! if (de == NULL)
! outofmem(__FILE__, "cookie_reject_domain");
!
! de->bv = REJECT_ALWAYS;
!
! StrAllocCopy(de->domain, strsmall);
! HTList_addObject(domain_list, de);
! } else {
! de2->bv = REJECT_ALWAYS;
! }
}
! FREE(str);
! FREE(strsmall);
}
#ifdef GLOBALDEF_IS_MACRO
diff -cr 2.8.1dev.21/src/LYrcFile.c 2.8.1dev.21.bri/src/LYrcFile.c
*** 2.8.1dev.21/src/LYrcFile.c Thu Aug 6 17:24:16 1998
--- 2.8.1dev.21.bri/src/LYrcFile.c Thu Aug 6 20:59:08 1998
***************
*** 440,446 ****
LYAcceptAllCookies = FALSE;
}
- #ifdef THIS_DOESNT_WORK_YET_DONT_USE_IT
/*
* Accept all cookies from certain domains?
--- 440,445 ----
***************
*** 451,459 ****
cp = cp2 + 1;
while (isspace(*cp))
cp++; /* get rid of spaces */
! if (LYstrstr(cp,NULL) != NULL) {
! /* cookie_add_acceptlist(cp); */
! }
/*
--- 450,456 ----
cp = cp2 + 1;
while (isspace(*cp))
cp++; /* get rid of spaces */
! cookie_add_acceptlist(cp);
/*
***************
*** 465,475 ****
cp = cp2 + 1;
while (isspace(*cp))
cp++; /* get rid of spaces */
! if (LYstrstr(cp,NULL) != NULL) {
! /* cookie_add_rejectlist(cp); */
! }
- #endif
/*
* User mode.
--- 462,469 ----
cp = cp2 + 1;
while (isspace(*cp))
cp++; /* get rid of spaces */
! cookie_add_rejectlist(cp);
/*
* User mode.
--
Know thyself. If you need help, call the C.I.A.
In the stairway of life, you'd best take the elevator.