diff options
author | Rob Bradford <rob@o-hand.com> | 2008-08-18 17:34:25 +0100 |
---|---|---|
committer | Rob Bradford <rob@o-hand.com> | 2008-08-18 17:34:25 +0100 |
commit | daacff4204496756124af8492a85a3a36ce591cc (patch) | |
tree | a42fbb708d50d4ec4241254cc7273e73a3a19653 /examples | |
download | librest-daacff4204496756124af8492a85a3a36ce591cc.tar.gz |
Initial commit
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 5 | ||||
-rw-r--r-- | examples/test-raw.c | 38 |
2 files changed, 43 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..3ac2af5 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,5 @@ +noinst_PROGRAMS = test-raw + +test_raw_SOURCES = test-raw.c +test_raw_LDADD = $(GLIB_LIBS) $(SOUP_LIBS) ../rest/librest.la +test_raw_CFLAGS = $(GLIB_CFLAGS) $(SOUP_CFLAGS) -I.. diff --git a/examples/test-raw.c b/examples/test-raw.c new file mode 100644 index 0000000..eddba43 --- /dev/null +++ b/examples/test-raw.c @@ -0,0 +1,38 @@ +#include <rest/rest-proxy.h> + +static void +proxy_call_raw_async_cb (RestProxy *proxy, + guint status_code, + const gchar *response_message, + GHashTable *headers, + const gchar *payload, + gssize len, + GObject *weak_object, + gpointer userdata) +{ + write (1, payload, len); +} + +gint +main (gint argc, gchar **argv) +{ + RestProxy *proxy; + GMainLoop *loop; + + g_type_init (); + g_thread_init (NULL); + + loop = g_main_loop_new (NULL, FALSE); + + proxy = rest_proxy_new ("http://www.o-hand.com/", FALSE); + rest_proxy_call_raw_async (proxy, + NULL, + "GET", + proxy_call_raw_async_cb, + NULL, + NULL, + NULL, + NULL); + + g_main_loop_run (loop); +} |