[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev Post-query bug (2nd try)
From: |
brian j. pardy |
Subject: |
Re: lynx-dev Post-query bug (2nd try) |
Date: |
Sun, 6 Dec 1998 15:04:18 -0800 |
On Sun, Nov 29, 1998, Elwin Oost wrote:
> Hi,
>
> I think I found a bug in the Cookies section when one dumps the
> output immediately with a post query.
>
> I want to fetch a post_data page from a site which redirects with a
> 302 (indeed, Microsoft) and keeps track of the user with a cookie.
> This didn't work, I checked all the switches and then dug into the
> Lynx code to see whether I had missed one, and then (probably)
> found the bug:
>
> LYCookie's store_cookie calls HTAlert's HTConfirmCookie for
> permission to store it. However, one of HTConfirmCookie's
> requirements is that the domain entry de isn't empty. However, with
> dump_output_immediately it stays NULL.
Could you try this patch out? It's against 2.8.2dev.8, and looks to me
like it fixes a problem, but it may not be yours. I didn't see anything
specifically related to post_data, but only to dump_output_immediately.
You were right about the domain entry de not being initialized in dump
immediately mode, I got rid of that. With this patch, there are no
special cases in LYCookie.c when we're in dump_output_immediately mode.
Additionally, I made a slight change to this mode in LYMain.c, so that
cookies received will also be written to the cookie file (cleanup() is
not called in -dump mode).
diff -cr 2.8.1dev.8/src/LYCookie.c 2.8.1dev.8.bri/src/LYCookie.c
*** 2.8.1dev.8/src/LYCookie.c Fri Dec 4 23:21:11 1998
--- 2.8.1dev.8.bri/src/LYCookie.c Sun Dec 6 14:59:51 1998
***************
*** 181,199 ****
}
dl = dl->next;
}
- if (dump_output_immediately) {
- cl = cookie_list;
- while (cl) {
- next = cl->next;
- co = cl->object;
- if (co) {
- HTList_removeObject(cookie_list, co);
- freeCookie(co);
- }
- cl = next;
- }
- HTList_delete(cookie_list);
- }
cookie_list = NULL;
HTList_delete(domain_list);
domain_list = NULL;
--- 181,186 ----
***************
*** 383,428 ****
* Look through domain_list to see if the cookie's domain
* is already listed.
*/
! if (dump_output_immediately) { /* Non-interactive, can't respond */
! if (cookie_list == NULL)
! cookie_list = HTList_new();
! } else {
! cookie_list = NULL;
! for (hl = domain_list; hl != NULL; hl = hl->next) {
! de = (domain_entry *)hl->object;
! if ((de != NULL && de->domain != NULL) &&
! !strcmp(co->domain, de->domain)) {
! cookie_list = de->cookie_list;
! break;
! }
! }
! if (hl == NULL) {
! /*
! * Domain not found; add a new entry for this domain.
! */
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
! if (de == NULL)
! outofmem(__FILE__, "store_cookie");
#ifdef EXP_PERSISTENT_COOKIES
! /*
! * Ok, this is a problem. The first cookie for a domain
! * effectively sets the policy for that whole domain - for
! * something like Netlink, where there are lots of websites
! * under www.netlink.co.uk, this isn't sensible. However,
! * taking this sort of decision down to cookie level also
! * isn't sensible. Perhaps something based on the domain
! * and the path in conjunction makes more sense? - RP
! */
! if (persistent_cookies
! && (co->flags & COOKIE_FLAG_PERSISTENT))
! de->bv = FROM_FILE;
! else
#endif
! de->bv = QUERY_USER;
! cookie_list = de->cookie_list = HTList_new();
! StrAllocCopy(de->domain, co->domain);
! HTList_addObject(domain_list, de);
! }
}
/*
--- 370,410 ----
* Look through domain_list to see if the cookie's domain
* is already listed.
*/
! cookie_list = NULL;
! for (hl = domain_list; hl != NULL; hl = hl->next) {
! de = (domain_entry *)hl->object;
! if ((de != NULL && de->domain != NULL) &&
! !strcmp(co->domain, de->domain)) {
! cookie_list = de->cookie_list;
! break;
! }
! }
! if (hl == NULL) {
! /*
! * Domain not found; add a new entry for this domain.
! */
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
! if (de == NULL)
! outofmem(__FILE__, "store_cookie");
#ifdef EXP_PERSISTENT_COOKIES
! /*
! * Ok, this is a problem. The first cookie for a domain
! * effectively sets the policy for that whole domain - for
! * something like Netlink, where there are lots of websites
! * under www.netlink.co.uk, this isn't sensible. However,
! * taking this sort of decision down to cookie level also
! * isn't sensible. Perhaps something based on the domain
! * and the path in conjunction makes more sense? - RP
! */
! if (persistent_cookies
! && (co->flags & COOKIE_FLAG_PERSISTENT))
! de->bv = FROM_FILE;
! else
#endif
! de->bv = QUERY_USER;
! cookie_list = de->cookie_list = HTList_new();
! StrAllocCopy(de->domain, co->domain);
! HTList_addObject(domain_list, de);
}
/*
diff -cr 2.8.1dev.8/src/LYMain.c 2.8.1dev.8.bri/src/LYMain.c
*** 2.8.1dev.8/src/LYMain.c Thu Dec 3 10:28:20 1998
--- 2.8.1dev.8.bri/src/LYMain.c Sun Dec 6 14:55:34 1998
***************
*** 1732,1737 ****
--- 1732,1745 ----
(keypad_mode == LINKS_ARE_NUMBERED ||
keypad_mode == LINKS_AND_FORM_FIELDS_ARE_NUMBERED))
printlist(stdout,FALSE);
+ #ifdef EXP_PERSISTENT_COOKIES
+ /*
+ * We want to save cookies picked up when in immediate dump
+ * mode. Instead of calling cleanup() here, let's only call
+ * this one. - BJP
+ */
+ LYStoreCookies(LYCookieFile);
+ #endif /* EXP_PERSISTENT_COOKIES */
exit_immediately(status);
} else {
/*
--
A LISP programmer knows the value of
everything, but the cost of nothing.
-- Alan Perlis
- Re: lynx-dev Post-query bug (2nd try),
brian j. pardy <=