summaryrefslogtreecommitdiff
path: root/frontends
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 /frontends
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 'frontends')
-rw-r--r--frontends/amiga/gui.c1
-rw-r--r--frontends/atari/gui.c1
-rw-r--r--frontends/beos/gui.cpp2
-rw-r--r--frontends/gtk/gui.c1
-rw-r--r--frontends/monkey/401login.c20
-rw-r--r--frontends/monkey/401login.h4
-rw-r--r--frontends/riscos/gui.c1
-rw-r--r--frontends/windows/main.c1
8 files changed, 19 insertions, 12 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 54273ee54..af9322e53 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6087,7 +6087,6 @@ static struct gui_misc_table amiga_misc_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
.cert_verify = ami_cert_verify,
- .login = gui_401login_open,
};
/** Normal entry point from OS */
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index 5e2fd6102..cce4e13ee 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -1108,7 +1108,6 @@ static struct gui_misc_table atari_misc_table = {
.quit = gui_quit,
.cert_verify = gui_cert_verify,
- .login = gui_401login_open,
};
/* #define WITH_DBG_LOGFILE 1 */
diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp
index f5bb5824e..b738d105d 100644
--- a/frontends/beos/gui.cpp
+++ b/frontends/beos/gui.cpp
@@ -997,7 +997,7 @@ static struct gui_misc_table beos_misc_table = {
gui_quit,
gui_launch_url,
NULL, //cert_verify
- gui_401login_open,
+ NULL, //401login
NULL, // pdf_password (if we have Haru support)
};
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index ee7e3365b..740543b44 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -1073,7 +1073,6 @@ static struct gui_misc_table nsgtk_misc_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
.cert_verify = gtk_cert_verify,
- .login = gui_401login_open,
.pdf_password = nsgtk_pdf_password,
};
diff --git a/frontends/monkey/401login.c b/frontends/monkey/401login.c
index b9e75bf8f..1629425f6 100644
--- a/frontends/monkey/401login.c
+++ b/frontends/monkey/401login.c
@@ -30,10 +30,12 @@
struct monkey401 {
struct monkey401 *r_next, *r_prev;
uint32_t num;
- nserror (*cb)(const char *, const char *, void *);
+ nserror (*cb)(struct nsurl*, const char *, const char *, const char *, void *);
void *cbpw;
char *username;
char *password;
+ char *realm;
+ struct nsurl *url;
};
static struct monkey401 *m401_ring = NULL;
@@ -45,7 +47,9 @@ gui_401login_open(struct nsurl *url,
const char *realm,
const char *username,
const char *password,
- nserror (*cb)(const char *username,
+ nserror (*cb)(struct nsurl *url,
+ const char *realm,
+ const char *username,
const char *password,
void *pw),
void *cbpw)
@@ -56,6 +60,12 @@ gui_401login_open(struct nsurl *url,
if (m401_ctx == NULL) {
return NSERROR_NOMEM;
}
+ m401_ctx->realm = strdup(realm);
+ if (m401_ctx->realm == NULL) {
+ free(m401_ctx);
+ return NSERROR_NOMEM;
+ }
+ m401_ctx->url = nsurl_ref(url);
m401_ctx->cb = cb;
m401_ctx->cbpw = cbpw;
m401_ctx->num = m401_ctr++;
@@ -102,6 +112,8 @@ static void free_login_context(struct monkey401 *m401_ctx) {
if (m401_ctx->password != NULL) {
free(m401_ctx->password);
}
+ free(m401_ctx->realm);
+ nsurl_unref(m401_ctx->url);
free(m401_ctx);
}
@@ -121,7 +133,7 @@ monkey_login_handle_go(int argc, char **argv)
return;
}
- m401_ctx->cb(m401_ctx->username, m401_ctx->password, m401_ctx->cbpw);
+ m401_ctx->cb(m401_ctx->url, m401_ctx->realm, m401_ctx->username, m401_ctx->password, m401_ctx->cbpw);
free_login_context(m401_ctx);
}
@@ -142,8 +154,6 @@ monkey_login_handle_destroy(int argc, char **argv)
return;
}
- m401_ctx->cb(NULL, NULL, m401_ctx->cbpw);
-
free_login_context(m401_ctx);
}
diff --git a/frontends/monkey/401login.h b/frontends/monkey/401login.h
index 9ebe46a62..45a2a1b52 100644
--- a/frontends/monkey/401login.h
+++ b/frontends/monkey/401login.h
@@ -27,7 +27,9 @@ nserror gui_401login_open(struct nsurl *url,
const char *realm,
const char *username,
const char *password,
- nserror (*cb)(const char *username,
+ nserror (*cb)(struct nsurl *url,
+ const char *realm,
+ const char *username,
const char *password,
void *pw),
void *cbpw);
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index 93bad1638..ef215487d 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -2432,7 +2432,6 @@ static struct gui_misc_table riscos_misc_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
.cert_verify = gui_cert_verify,
- .login = gui_401login_open,
};
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 6592e1626..bae7815ae 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -314,7 +314,6 @@ static struct gui_misc_table win32_misc_table = {
.warning = win32_warning,
.cert_verify = nsw32_cert_verify,
- .login = nsw32_401login,
};
/**