From 8469f4cc8e62e80a3165a1d4f13b62b5b4a04720 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Tue, 6 Aug 2019 11:25:11 +0100 Subject: Reimplement handling of BAD_AUTH inside browser_window We now handle authentication requests via an `about:` page which presents a nice form built into the browser window. In order to do this, we add internal navigation as a concept to the browser window and we strip the 401login support from all frontends except monkey. The 401login callback is now intended for password safe type support rather than an immediately interactive prompt. Signed-off-by: Daniel Silverstone --- content/fetch.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'content/fetch.c') diff --git a/content/fetch.c b/content/fetch.c index 766502941..2ac86a812 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -712,6 +712,23 @@ fetch_multipart_data_clone(const struct fetch_multipart_data *list) return result; } + +/* exported interface documented in content/fetch.h */ +const char * +fetch_multipart_data_find(const struct fetch_multipart_data *list, + const char *name) +{ + while (list != NULL) { + if (strcmp(list->name, name) == 0) { + return list->value; + } + list = list->next; + } + + return NULL; +} + + /* exported interface documented in content/fetch.h */ void fetch_multipart_data_destroy(struct fetch_multipart_data *list) { @@ -730,6 +747,43 @@ void fetch_multipart_data_destroy(struct fetch_multipart_data *list) } } + +/* exported interface documented in content/fetch.h */ +nserror +fetch_multipart_data_new_kv(struct fetch_multipart_data **list, + const char *name, + const char *value) +{ + struct fetch_multipart_data *newdata; + + assert(list); + + newdata = calloc(sizeof(*newdata), 1); + + if (newdata == NULL) { + return NSERROR_NOMEM; + } + + newdata->name = strdup(name); + if (newdata->name == NULL) { + free(newdata); + return NSERROR_NOMEM; + } + + newdata->value = strdup(value); + if (newdata->value == NULL) { + free(newdata->name); + free(newdata); + return NSERROR_NOMEM; + } + + newdata->next = *list; + *list = newdata; + + return NSERROR_OK; +} + + /* exported interface documented in content/fetch.h */ void fetch_send_callback(const fetch_msg *msg, struct fetch *fetch) -- cgit v1.2.3