diff options
author | Dan Winship <danw@src.gnome.org> | 2002-11-11 22:15:29 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-11-11 22:15:29 +0000 |
commit | e3172515fcfb95e994cf4eadadeb6fd62b5d221f (patch) | |
tree | 0f9ff7b4ac825e607cfa0f3ec100a36094500e0d /tests | |
parent | d4629510fb547f3ed2cce829ea1ec0c73bc5647c (diff) | |
download | libsoup-e3172515fcfb95e994cf4eadadeb6fd62b5d221f.tar.gz |
Move the SoupAddress code from soup-socket.c and soup-socket-unix.c to
* libsoup/soup-address.c: Move the SoupAddress code from
soup-socket.c and soup-socket-unix.c to here.
* libsoup/soup-socket.c: Move the remaining code from
soup-socket-unix.c here.
* libsoup/soup-socket-unix.c: Gone
* tests/get.c: really really trivial test program
* configure.in (AC_OUTPUT):
* Makefile.am (SUBDIRS): add tests/
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.cvsignore | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 9 | ||||
-rw-r--r-- | tests/get.c | 35 |
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore new file mode 100644 index 00000000..ee2b3d19 --- /dev/null +++ b/tests/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +get diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 00000000..8bc2102d --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,9 @@ +noinst_PROGRAMS = get + +get_SOURCES = get.c + +INCLUDES = \ + -I$(top_srcdir) \ + $(GLIB_CFLAGS) + +get_LDADD = $(top_builddir)/libsoup/libsoup-2.0.la diff --git a/tests/get.c b/tests/get.c new file mode 100644 index 00000000..5d83d346 --- /dev/null +++ b/tests/get.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> +#include <libsoup/soup.h> + +int +main (int argc, char **argv) +{ + SoupContext *ctx; + SoupMessage *msg; + + if (argc != 2) { + fprintf (stderr, "Usage: %s URL\n", argv[0]); + exit (1); + } + + ctx = soup_context_get (argv[1]); + if (!ctx) { + fprintf (stderr, "Could not parse '%s' as a URL\n", argv[1]); + exit (1); + } + + msg = soup_message_new (ctx, SOUP_METHOD_GET); + soup_context_unref (ctx); + + soup_message_send (msg); + + printf ("%d %s\n", msg->errorcode, msg->errorphrase); + if (SOUP_ERROR_IS_SUCCESSFUL (msg->errorcode)) { + fwrite (msg->response.body, msg->response.length, 1, stdout); + printf ("\n"); + } + + soup_message_free (msg); + return 0; +} |