summaryrefslogtreecommitdiff
path: root/src/wispr.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-02-14 12:05:43 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-02-14 14:55:55 +0100
commit4130aedfe7bf313c4b28e2d84edf38ebcdcac1cf (patch)
tree96054610289058b81d22266f81c7fc763ff224c5 /src/wispr.c
parent484a573ed476cf4d4405b26f4b2ca16e881b5cd3 (diff)
downloadconnman-4130aedfe7bf313c4b28e2d84edf38ebcdcac1cf.tar.gz
connman-4130aedfe7bf313c4b28e2d84edf38ebcdcac1cf.tar.bz2
connman-4130aedfe7bf313c4b28e2d84edf38ebcdcac1cf.zip
wispr: Request a browser action through agent api
Diffstat (limited to 'src/wispr.c')
-rw-r--r--src/wispr.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wispr.c b/src/wispr.c
index 9c45c72e..9c0ed438 100644
--- a/src/wispr.c
+++ b/src/wispr.c
@@ -64,6 +64,8 @@ struct connman_wispr_portal_context {
const char *status_url;
+ char *redirect_url;
+
/* WISPr specific */
GWebParser *wispr_parser;
struct connman_wispr_message wispr_msg;
@@ -130,6 +132,8 @@ static void free_connman_wispr_portal_context(struct connman_wispr_portal_contex
g_web_unref(wp_context->web);
+ g_free(wp_context->redirect_url);
+
g_web_parser_unref(wp_context->wispr_parser);
connman_wispr_message_init(&wp_context->wispr_msg);
@@ -563,15 +567,23 @@ static gboolean wispr_portal_web_result(GWebResult *result, gpointer user_data)
if (g_web_result_get_header(result, "X-ConnMan-Status",
&str) == TRUE)
portal_manage_status(result, wp_context);
+ else
+ __connman_agent_request_browser(wp_context->service,
+ NULL, wp_context->redirect_url, wp_context);
break;
case 302:
if (g_web_result_get_header(result, "Location",
- &redirect) == FALSE)
+ &redirect) == FALSE) {
+ __connman_agent_request_browser(wp_context->service,
+ NULL, wp_context->status_url, wp_context);
break;
+ }
DBG("Redirect URL: %s", redirect);
+ wp_context->redirect_url = g_strdup(redirect);
+
wp_context->request_id = g_web_request_get(wp_context->web,
redirect, wispr_portal_web_result, wp_context);