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[] = {
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);
return 1;
}
- web = g_web_new();
+ web = g_web_new(index);
if (web == NULL) {
printf("failed to web service\n");
return 1;
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);