1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

cookies: "Add Server" ignores "cookies.accept_policy".

src/cookies/dialogs.c (set_server): Set up a struct cookie and pass it
to accept_cookie, instead of calling set_cookie which might ask the user
to confirm.  (This change also removes a dubious use of struct uri.)

src/cookies/cookies.c (get_cookie_server): No longer static.

src/cookies/cookies.h (get_cookie_server): Declare.
This commit is contained in:
Kalle Olavi Niemitalo 2006-05-28 00:56:42 +03:00 committed by Miciah Dashiel Butler Masters
parent d10a489a14
commit 96391c17b4
3 changed files with 19 additions and 7 deletions

View File

@ -125,7 +125,7 @@ static struct option_info cookies_options[] = {
#define get_cookies_save() get_opt_cookies(COOKIES_SAVE).number
#define get_cookies_resave() get_opt_cookies(COOKIES_RESAVE).number
static struct cookie_server *
struct cookie_server *
get_cookie_server(unsigned char *host, int hostlen)
{
struct cookie_server *sort_spot = NULL;

View File

@ -35,6 +35,7 @@ struct cookie {
struct listbox_item *box_item;
};
struct cookie_server *get_cookie_server(unsigned char *host, int hostlen);
void accept_cookie(struct cookie *);
void done_cookie(struct cookie *);
void delete_cookie(struct cookie *);

View File

@ -414,15 +414,26 @@ static widget_handler_status_T
set_server(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
unsigned char *value = widget_data->cdata;
struct uri uri;
struct cookie *dummy_cookie = NULL;
if (!value) return EVENT_NOT_PROCESSED;
uri.host = stracpy(value);
if (uri.host) {
uri.hostlen = strlen(value);
set_cookie(&uri, "empty=1; path=/;");
mem_free(uri.host);
dummy_cookie = mem_calloc(1, sizeof(*dummy_cookie));
if (dummy_cookie == NULL) return EVENT_PROCESSED;
dummy_cookie->name = stracpy("empty");
dummy_cookie->value = stracpy("1");
dummy_cookie->path = stracpy("/");
dummy_cookie->domain = stracpy(value);
dummy_cookie->server = get_cookie_server(value, strlen(value));
if (dummy_cookie->name == NULL || dummy_cookie->value == NULL
|| dummy_cookie->path == NULL || dummy_cookie->domain == NULL
|| dummy_cookie->server == NULL) {
done_cookie(dummy_cookie);
return EVENT_PROCESSED;
}
accept_cookie(dummy_cookie);
return EVENT_PROCESSED;
}