mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Haiku: Update for new HTTP auth API.
This commit is contained in:
parent
6144993c8a
commit
e41e558c5f
@ -35,7 +35,12 @@ extern bool nsbeos_done;
|
||||
extern bool replicated;
|
||||
int gui_init_replicant(int argc, char** argv);
|
||||
|
||||
extern "C" void gui_401login_open(struct nsurl *url, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw);
|
||||
extern "C" void nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
const char *username, const char *password,
|
||||
nserror (*cb)(const char *username,
|
||||
const char *password,
|
||||
void *pw),
|
||||
void *cbpw);
|
||||
|
||||
extern "C" void nsbeos_gui_poll(void);
|
||||
|
||||
|
@ -44,7 +44,9 @@ extern "C" {
|
||||
|
||||
class LoginAlert : public BAlert {
|
||||
public:
|
||||
LoginAlert(nserror (*callback)(bool proceed, void *pw),
|
||||
LoginAlert(nserror (*callback)(const char *username,
|
||||
const char *password,
|
||||
void *pw),
|
||||
void *callbaclpw,
|
||||
nsurl *url,
|
||||
const char *host,
|
||||
@ -57,7 +59,9 @@ private:
|
||||
nsurl* fUrl; /**< URL being fetched */
|
||||
BString fHost; /**< Host for user display */
|
||||
BString fRealm; /**< Authentication realm */
|
||||
nserror (*fCallback)(bool proceed, void *pw);
|
||||
nserror (*fCallback)(const char *username,
|
||||
const char *password,
|
||||
void *pw);
|
||||
void *fCallbackPw;
|
||||
|
||||
BTextControl *fUserControl;
|
||||
@ -66,13 +70,17 @@ private:
|
||||
|
||||
static void create_login_window(nsurl *host,
|
||||
lwc_string *realm, const char *fetchurl,
|
||||
nserror (*cb)(bool proceed, void *pw), void *cbpw);
|
||||
nserror (*cb)(const char *username,
|
||||
const char *password,
|
||||
void *pw), void *cbpw);
|
||||
|
||||
|
||||
#define TC_H 25
|
||||
#define TC_MARGIN 10
|
||||
|
||||
LoginAlert::LoginAlert(nserror (*callback)(bool proceed, void *pw),
|
||||
LoginAlert::LoginAlert(nserror (*callback)(const char *username,
|
||||
const char *password,
|
||||
void *pw),
|
||||
void *callbackpw,
|
||||
nsurl *url,
|
||||
const char *host,
|
||||
@ -164,8 +172,12 @@ LoginAlert::MessageReceived(BMessage *message)
|
||||
}
|
||||
|
||||
|
||||
extern "C" void gui_401login_open(nsurl *url, const char *realm,
|
||||
nserror (*cb)(bool proceed, void *pw), void *cbpw)
|
||||
extern "C" nserror gui_401login_open(nsurl *url, const char *realm,
|
||||
const char *username, const char *password,
|
||||
nserror (*cb)(const char *username,
|
||||
const char *password,
|
||||
void *pw),
|
||||
void *cbpw)
|
||||
{
|
||||
lwc_string *host;
|
||||
|
||||
@ -174,12 +186,17 @@ extern "C" void gui_401login_open(nsurl *url, const char *realm,
|
||||
create_login_window(url, host, realm, cb, cbpw);
|
||||
|
||||
free(host);
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
//void create_login_window(struct browser_window *bw, const char *host,
|
||||
// const char *realm, const char *fetchurl)
|
||||
static void create_login_window(nsurl *url, lwc_string *host,
|
||||
const char *realm, nserror (*cb)(bool proceed, void *pw),
|
||||
const char *realm, nserror (*cb)(
|
||||
const char *username,
|
||||
const char *password,
|
||||
void *pw),
|
||||
void *cbpw)
|
||||
{
|
||||
BString r("Secure Area");
|
||||
|
@ -655,23 +655,26 @@ void nsbeos_dispatch_event(BMessage *message)
|
||||
{
|
||||
nsurl* url;
|
||||
BString realm;
|
||||
BString auth;
|
||||
BString username;
|
||||
BString password;
|
||||
void* cbpw;
|
||||
nserror (*cb)(bool proceed, void* pw);
|
||||
nserror (*cb)(const char *username,
|
||||
const char *password,
|
||||
void *pw);
|
||||
|
||||
if (message->FindPointer("URL", (void**)&url) < B_OK)
|
||||
break;
|
||||
if (message->FindString("Realm", &realm) < B_OK)
|
||||
break;
|
||||
if (message->FindString("Auth", &auth) < B_OK)
|
||||
if (message->FindString("User", &username) < B_OK)
|
||||
break;
|
||||
if (message->FindString("Pass", &password) < B_OK)
|
||||
break;
|
||||
if (message->FindPointer("callback", (void**)&cb) < B_OK)
|
||||
break;
|
||||
if (message->FindPointer("callback_pw", (void**)&cbpw) < B_OK)
|
||||
break;
|
||||
//printf("login to '%s' with '%s'\n", url.String(), auth.String());
|
||||
urldb_set_auth_details(url, realm.String(), auth.String());
|
||||
cb(true, cbpw);
|
||||
cb(username.String(), password.String(), cbpw);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user