summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-08-01 23:42:13 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2010-08-01 23:42:13 (GMT)
commit335fb71873349127a830f37e5c71817bba801460 (patch)
tree247095a93928abf242571d8f82522cb461ab4f3f
parent21277c943191120d84839713caefb762ca918016 (diff)
downloadconnman-335fb71873349127a830f37e5c71817bba801460.zip
connman-335fb71873349127a830f37e5c71817bba801460.tar.gz
connman-335fb71873349127a830f37e5c71817bba801460.tar.bz2
Fix up test tool for web service library
-rw-r--r--tools/web-test.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/web-test.c b/tools/web-test.c
index cf85c71..1d8301f 100644
--- a/tools/web-test.c
+++ b/tools/web-test.c
@@ -44,6 +44,19 @@ static void sig_term(int sig)
g_main_loop_quit(main_loop);
}
+static void web_result(uint16_t status, gpointer user_data)
+{
+ gdouble elapsed;
+
+ elapsed = g_timer_elapsed(timer, NULL);
+
+ g_print("elapse: %f seconds\n", elapsed);
+
+ g_print("status: %03u\n", status);
+
+ g_main_loop_quit(main_loop);
+}
+
static gboolean option_debug = FALSE;
static GOptionEntry options[] = {
@@ -58,6 +71,7 @@ int main(int argc, char *argv[])
GError *error = NULL;
struct sigaction sa;
GWeb *web;
+ int index = 0;
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
@@ -78,7 +92,7 @@ int main(int argc, char *argv[])
return 1;
}
- web = g_web_new();
+ web = g_web_new(index);
if (web == NULL) {
printf("failed to web service\n");
return 1;
@@ -91,6 +105,12 @@ int main(int argc, char *argv[])
timer = g_timer_new();
+ if (g_web_request(web, G_WEB_METHOD_GET, argv[1],
+ web_result, NULL) == 0) {
+ printf("failed to start request\n");
+ return 1;
+ }
+
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_term;
sigaction(SIGINT, &sa, NULL);