summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-06 11:25:11 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-08-06 11:26:47 +0100
commit8469f4cc8e62e80a3165a1d4f13b62b5b4a04720 (patch)
tree707b46c3cf0b373b53adf8c54d290e4c546ebb2c /include
parent9c9c26a308995c22210c90e3772e86f49a1948b9 (diff)
downloadnetsurf-8469f4cc8e62e80a3165a1d4f13b62b5b4a04720.tar.gz
netsurf-8469f4cc8e62e80a3165a1d4f13b62b5b4a04720.tar.bz2
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 <dsilvers@digital-scurf.org>
Diffstat (limited to 'include')
-rw-r--r--include/netsurf/browser_window.h5
-rw-r--r--include/netsurf/misc.h34
2 files changed, 27 insertions, 12 deletions
diff --git a/include/netsurf/browser_window.h b/include/netsurf/browser_window.h
index d21af2629..0b140521f 100644
--- a/include/netsurf/browser_window.h
+++ b/include/netsurf/browser_window.h
@@ -120,7 +120,10 @@ enum browser_window_nav_flags {
BW_NAVIGATE_UNVERIFIABLE = (1 << 2),
/** suppress initial history updates (used by back/fwd/etc) */
- BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE = (1 << 3)
+ BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE = (1 << 3),
+
+ /** Internal navigation (set only by core features using such) */
+ BW_NAVIGATE_INTERNAL = (1 << 4)
};
/**
diff --git a/include/netsurf/misc.h b/include/netsurf/misc.h
index cd86cf644..ac58cf302 100644
--- a/include/netsurf/misc.h
+++ b/include/netsurf/misc.h
@@ -98,19 +98,29 @@ struct gui_misc_table {
void *cbpw);
/**
- * Prompt user for login
+ * Retrieve username/password for a given url+realm if there is one
+ * stored in a frontend-specific way (e.g. gnome-keyring)
*
- * To cancel a login, clients should call the `cb` callback passing
- * NULL for username, and password. Otherwise, for logins, username
- * and password should both be non-NULL. Pass "" if the empty string
+ * To respond, call the callback with the url, realm, username,
+ * and password. Pass "" if the empty string
* is required.
*
- * If the front end returns NSERROR_OK for this function, they must,
+ * To keep hold of the url, remember to nsurl_ref() it, and to keep
+ * the realm, you will need to strdup() it.
+ *
+ * If the front end returns NSERROR_OK for this function, they may,
* at some future time, call the `cb` with `cbpw` callback exactly once.
*
- * If ther front end returns other than NSERROR_OK, they should not
+ * If the front end returns other than NSERROR_OK, they should not
* call the `cb` callback.
*
+ * The callback should not be called immediately upon receipt of this
+ * call as the browser window may not be reentered.
+ *
+ * **NOTE** The lifetime of the cbpw is not well defined. In general
+ * do not use the cb if *any* browser window has navigated or been
+ * destroyed.
+ *
* \param url The URL being verified.
* \param realm The authorization realm.
* \param username Any current username (or empty string).
@@ -120,11 +130,13 @@ struct gui_misc_table {
* \return NSERROR_OK on sucess else error and cb never called
*/
nserror (*login)(struct nsurl *url, const char *realm,
- const char *username, const char *password,
- nserror (*cb)(const char *username,
- const char *password,
- void *pw),
- void *cbpw);
+ const char *username, const char *password,
+ nserror (*cb)(struct nsurl *url,
+ const char *realm,
+ const char *username,
+ const char *password,
+ void *pw),
+ void *cbpw);
/**
* Prompt the user for a password for a PDF.