[libsoup] Clean up includes



commit d9db0727ff48f96f5312e65c8f0296f634d2c2b4
Author: Dan Winship <danw gnome org>
Date:   Fri Jul 6 13:09:50 2012 -0400

    Clean up includes
    
    Especially, include soup.h rather than individually including a bunch
    of other public soup-*.h files.
    
    Remove unnecessary system includes (many are leftovers from code that
    has moved down into glib).

 libsoup/soup-address.c                |   10 +-----
 libsoup/soup-auth-basic.c             |    5 +--
 libsoup/soup-auth-digest.c            |   10 +-----
 libsoup/soup-auth-domain-basic.c      |    3 +-
 libsoup/soup-auth-domain-digest.c     |    4 +--
 libsoup/soup-auth-domain.c            |    3 +-
 libsoup/soup-auth-manager-ntlm.c      |   13 ++------
 libsoup/soup-auth-manager.c           |    6 +---
 libsoup/soup-auth-ntlm.c              |    5 +--
 libsoup/soup-auth.c                   |    2 -
 libsoup/soup-body-input-stream.c      |    5 +--
 libsoup/soup-body-output-stream.c     |   10 ++----
 libsoup/soup-cache.c                  |    9 +-----
 libsoup/soup-client-input-stream.c    |    4 +--
 libsoup/soup-connection.c             |   18 +----------
 libsoup/soup-content-decoder.c        |    8 +----
 libsoup/soup-content-sniffer-stream.c |    4 +--
 libsoup/soup-content-sniffer.c        |    5 +--
 libsoup/soup-converter-wrapper.c      |    2 +-
 libsoup/soup-cookie-jar-sqlite.c      |    6 +--
 libsoup/soup-cookie-jar-text.c        |    3 +-
 libsoup/soup-cookie-jar.c             |    9 +-----
 libsoup/soup-cookie.c                 |    6 +---
 libsoup/soup-date.c                   |    2 +-
 libsoup/soup-directory-input-stream.c |    7 ++--
 libsoup/soup-filter-input-stream.c    |    3 +-
 libsoup/soup-form.c                   |    3 +-
 libsoup/soup-headers.c                |    5 +--
 libsoup/soup-io-stream.c              |    3 +-
 libsoup/soup-logger.c                 |    6 +---
 libsoup/soup-message-body.c           |    1 +
 libsoup/soup-message-client-io.c      |    7 +----
 libsoup/soup-message-headers.c        |    8 ++---
 libsoup/soup-message-io.c             |    6 +---
 libsoup/soup-message-queue.c          |    2 +-
 libsoup/soup-message-server-io.c      |    8 +----
 libsoup/soup-message.c                |   13 ++-----
 libsoup/soup-misc.c                   |    1 -
 libsoup/soup-multipart.c              |    2 +-
 libsoup/soup-password-manager-gnome.c |    8 ++---
 libsoup/soup-password-manager.c       |    2 +-
 libsoup/soup-path-map.c               |    3 +-
 libsoup/soup-proxy-resolver-default.c |    7 +----
 libsoup/soup-proxy-resolver-gnome.c   |    1 +
 libsoup/soup-proxy-resolver-static.c  |    7 +----
 libsoup/soup-proxy-resolver.c         |    6 +---
 libsoup/soup-proxy-uri-resolver.c     |    2 +-
 libsoup/soup-request-data.c           |    7 ++--
 libsoup/soup-request-file.c           |    6 ++--
 libsoup/soup-request-http.c           |    7 +---
 libsoup/soup-request.c                |    3 +-
 libsoup/soup-requester.c              |    3 +-
 libsoup/soup-server.c                 |   10 +-----
 libsoup/soup-session-async.c          |    6 +---
 libsoup/soup-session-feature.c        |    1 +
 libsoup/soup-session-sync.c           |    6 +---
 libsoup/soup-session.c                |   15 +--------
 libsoup/soup-socket.c                 |    9 +-----
 libsoup/soup-status.c                 |    7 ++--
 libsoup/soup-tld.c                    |    5 ++-
 libsoup/soup-tld.h                    |    2 +
 libsoup/soup-uri.c                    |    4 +--
 libsoup/soup-value-utils.c            |    6 +++-
 libsoup/soup-xmlrpc.c                 |    7 +----
 tests/auth-test.c                     |   16 +---------
 tests/chunk-test.c                    |    9 -----
 tests/coding-test.c                   |   17 ----------
 tests/connection-test.c               |    4 --
 tests/context-test.c                  |   18 -----------
 tests/continue-test.c                 |    9 -----
 tests/cookies-test.c                  |    5 ---
 tests/date.c                          |    6 ----
 tests/dns.c                           |   21 +++++-------
 tests/forms-test.c                    |   20 +-----------
 tests/get.c                           |   48 +++++++++++------------------
 tests/header-parsing.c                |    8 +----
 tests/misc-test.c                     |    6 ----
 tests/ntlm-test.c                     |   17 ----------
 tests/proxy-test.c                    |   15 +---------
 tests/pull-api.c                      |   17 ++---------
 tests/range-test.c                    |   16 ++--------
 tests/redirect-test.c                 |   15 +---------
 tests/requester-test.c                |   13 +-------
 tests/server-auth-test.c              |   22 +-------------
 tests/simple-httpd.c                  |   39 ++++++++++--------------
 tests/simple-proxy.c                  |   41 +++++++++----------------
 tests/sniffing-test.c                 |    6 ----
 tests/ssl-test.c                      |    6 +---
 tests/streaming-test.c                |   13 +-------
 tests/test-utils.c                    |   33 +++++++++------------
 tests/test-utils.h                    |   11 ++++++-
 tests/timeout-test.c                  |   12 +-------
 tests/tld-test.c                      |    4 --
 tests/uri-parsing.c                   |   16 ++-------
 tests/xmlrpc-server-test.c            |   14 ++-------
 tests/xmlrpc-test.c                   |   53 ++++++++++++++------------------
 96 files changed, 226 insertions(+), 691 deletions(-)
---
diff --git a/libsoup/soup-address.c b/libsoup/soup-address.c
index 38974c6..f2e698b 100644
--- a/libsoup/soup-address.c
+++ b/libsoup/soup-address.c
@@ -9,19 +9,11 @@
 #include <config.h>
 #endif
 
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
-
-#include <gio/gio.h>
 
 #include "soup-address.h"
-#include "soup-enum-types.h"
+#include "soup.h"
 #include "soup-marshal.h"
-#include "soup-misc.h"
 
 /**
  * SECTION:soup-address
diff --git a/libsoup/soup-auth-basic.c b/libsoup/soup-auth-basic.c
index 7df7e1e..fb491c7 100644
--- a/libsoup/soup-auth-basic.c
+++ b/libsoup/soup-auth-basic.c
@@ -12,10 +12,7 @@
 #include <string.h>
 
 #include "soup-auth-basic.h"
-#include "soup-headers.h"
-#include "soup-message.h"
-#include "soup-misc.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 typedef struct {
 	char *token;
diff --git a/libsoup/soup-auth-digest.c b/libsoup/soup-auth-digest.c
index 712967f..5fe7561 100644
--- a/libsoup/soup-auth-digest.c
+++ b/libsoup/soup-auth-digest.c
@@ -9,17 +9,11 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
 #include <string.h>
-#include <time.h>
-#include <unistd.h>
 
 #include "soup-auth-digest.h"
-#include "soup-headers.h"
-#include "soup-message.h"
+#include "soup.h"
 #include "soup-message-private.h"
-#include "soup-misc.h"
-#include "soup-uri.h"
 
 typedef struct {
 	char                    *user;
@@ -340,7 +334,7 @@ soup_auth_digest_compute_response (const char        *method,
 	if (qop) {
 		char tmp[9];
 
-		snprintf (tmp, 9, "%.8x", nc);
+		g_snprintf (tmp, 9, "%.8x", nc);
 		g_checksum_update (checksum, (guchar *)tmp, strlen (tmp));
 		g_checksum_update (checksum, (guchar *)":", 1);
 		g_checksum_update (checksum, (guchar *)cnonce, strlen (cnonce));
diff --git a/libsoup/soup-auth-domain-basic.c b/libsoup/soup-auth-domain-basic.c
index 0575caa..9e8afe8 100644
--- a/libsoup/soup-auth-domain-basic.c
+++ b/libsoup/soup-auth-domain-basic.c
@@ -12,9 +12,8 @@
 #include <string.h>
 
 #include "soup-auth-domain-basic.h"
-#include "soup-headers.h"
+#include "soup.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
 
 /**
  * SECTION:soup-auth-domain-basic
diff --git a/libsoup/soup-auth-domain-digest.c b/libsoup/soup-auth-domain-digest.c
index 86e2285..985919f 100644
--- a/libsoup/soup-auth-domain-digest.c
+++ b/libsoup/soup-auth-domain-digest.c
@@ -13,11 +13,9 @@
 #include <stdlib.h>
 
 #include "soup-auth-domain-digest.h"
+#include "soup.h"
 #include "soup-auth-digest.h"
-#include "soup-headers.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-auth-domain-digest
diff --git a/libsoup/soup-auth-domain.c b/libsoup/soup-auth-domain.c
index 6b7a629..2ac37e3 100644
--- a/libsoup/soup-auth-domain.c
+++ b/libsoup/soup-auth-domain.c
@@ -12,9 +12,8 @@
 #include <string.h>
 
 #include "soup-auth-domain.h"
-#include "soup-message.h"
+#include "soup.h"
 #include "soup-path-map.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-auth-domain
diff --git a/libsoup/soup-auth-manager-ntlm.c b/libsoup/soup-auth-manager-ntlm.c
index ae59504..f2b67d1 100644
--- a/libsoup/soup-auth-manager-ntlm.c
+++ b/libsoup/soup-auth-manager-ntlm.c
@@ -11,21 +11,14 @@
 #endif
 
 #include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
 #include <string.h>
-#include <glib.h>
 
-#ifdef USE_NTLM_AUTH
-#include <stdlib.h>
-#include <errno.h>
-#endif
 #include "soup-auth-manager-ntlm.h"
+#include "soup.h"
 #include "soup-auth-ntlm.h"
-#include "soup-message.h"
 #include "soup-message-private.h"
-#include "soup-misc.h"
-#include "soup-session.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
 
 static void soup_auth_manager_ntlm_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer interface_data);
 static SoupSessionFeatureInterface *soup_auth_manager_parent_feature_interface;
diff --git a/libsoup/soup-auth-manager.c b/libsoup/soup-auth-manager.c
index 64637e9..b3ef9f6 100644
--- a/libsoup/soup-auth-manager.c
+++ b/libsoup/soup-auth-manager.c
@@ -12,16 +12,12 @@
 #include <string.h>
 
 #include "soup-auth-manager.h"
-#include "soup-address.h"
-#include "soup-headers.h"
+#include "soup.h"
 #include "soup-marshal.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
 #include "soup-path-map.h"
-#include "soup-session.h"
-#include "soup-session-feature.h"
 #include "soup-session-private.h"
-#include "soup-uri.h"
 
 static void soup_auth_manager_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer interface_data);
 static SoupSessionFeatureInterface *soup_session_feature_default_interface;
diff --git a/libsoup/soup-auth-ntlm.c b/libsoup/soup-auth-ntlm.c
index 7bba70f..391c1c2 100644
--- a/libsoup/soup-auth-ntlm.c
+++ b/libsoup/soup-auth-ntlm.c
@@ -12,10 +12,7 @@
 #include <string.h>
 
 #include "soup-auth-ntlm.h"
-#include "soup-headers.h"
-#include "soup-message.h"
-#include "soup-misc.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 typedef struct {
 	char *username, *password;
diff --git a/libsoup/soup-auth.c b/libsoup/soup-auth.c
index 73f0c79..6960e52 100644
--- a/libsoup/soup-auth.c
+++ b/libsoup/soup-auth.c
@@ -14,8 +14,6 @@
 #include <string.h>
 
 #include "soup-auth.h"
-#include "soup-auth-basic.h"
-#include "soup-auth-digest.h"
 #include "soup-headers.h"
 #include "soup-marshal.h"
 #include "soup-uri.h"
diff --git a/libsoup/soup-body-input-stream.c b/libsoup/soup-body-input-stream.c
index e554f21..a38955f 100644
--- a/libsoup/soup-body-input-stream.c
+++ b/libsoup/soup-body-input-stream.c
@@ -10,16 +10,13 @@
 #endif
 
 #include <stdlib.h>
-#include <string.h>
-#include <gio/gio.h>
 
 #include <glib/gi18n-lib.h>
 
 #include "soup-body-input-stream.h"
-#include "soup-enum-types.h"
+#include "soup.h"
 #include "soup-filter-input-stream.h"
 #include "soup-marshal.h"
-#include "soup-message-headers.h"
 
 typedef enum {
 	SOUP_BODY_INPUT_STREAM_STATE_CHUNK_SIZE,
diff --git a/libsoup/soup-body-output-stream.c b/libsoup/soup-body-output-stream.c
index 5c93347..86f131a 100644
--- a/libsoup/soup-body-output-stream.c
+++ b/libsoup/soup-body-output-stream.c
@@ -9,14 +9,10 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <gio/gio.h>
 
 #include "soup-body-output-stream.h"
-#include "soup-enum-types.h"
-#include "soup-message-headers.h"
+#include "soup.h"
 
 typedef enum {
 	SOUP_BODY_OUTPUT_STREAM_STATE_CHUNK_SIZE,
@@ -162,8 +158,8 @@ again:
 
 	switch (bostream->priv->chunked_state) {
 	case SOUP_BODY_OUTPUT_STREAM_STATE_CHUNK_SIZE:
-		snprintf (buf, sizeof (bostream->priv->buf),
-			  "%lx\r\n", (gulong)count);
+		g_snprintf (buf, sizeof (bostream->priv->buf),
+			    "%lx\r\n", (gulong)count);
 		len = strlen (buf);
 
 		if (count > 0)
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index fc44053..95182f8 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -29,20 +29,13 @@
 #include <config.h>
 #endif
 
-#include <stdlib.h>
 #include <string.h>
-#include <gio/gio.h>
 
 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-cache.h"
 #include "soup-cache-private.h"
-#include "soup-date.h"
-#include "soup-enum-types.h"
-#include "soup-headers.h"
-#include "soup-session.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 static SoupSessionFeatureInterface *soup_cache_default_feature_interface;
 static void soup_cache_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer interface_data);
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index 29ac87e..a22c685 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -9,11 +9,9 @@
 #include <config.h>
 #endif
 
-#include <gio/gio.h>
-
 #include "soup-client-input-stream.h"
+#include "soup.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
 #include "soup-message-private.h"
 
 struct _SoupClientInputStreamPrivate {
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index a70e764..c9d8884 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -9,27 +9,11 @@
 #include <config.h>
 #endif
 
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include <fcntl.h>
-#include <sys/types.h>
-
-#include "soup-address.h"
 #include "soup-connection.h"
+#include "soup.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
-#include "soup-message-private.h"
 #include "soup-message-queue.h"
-#include "soup-misc.h"
 #include "soup-misc-private.h"
-#include "soup-proxy-uri-resolver.h"
-#include "soup-proxy-resolver-default.h"
-#include "soup-socket.h"
-#include "soup-uri.h"
-#include "soup-enum-types.h"
 
 typedef struct {
 	SoupSocket  *socket;
diff --git a/libsoup/soup-content-decoder.c b/libsoup/soup-content-decoder.c
index aeda5f0..0651338 100644
--- a/libsoup/soup-content-decoder.c
+++ b/libsoup/soup-content-decoder.c
@@ -9,15 +9,9 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-#include <gio/gio.h>
-
 #include "soup-content-decoder.h"
-#include "soup-enum-types.h"
-#include "soup-message.h"
+#include "soup.h"
 #include "soup-message-private.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-content-decoder
diff --git a/libsoup/soup-content-sniffer-stream.c b/libsoup/soup-content-sniffer-stream.c
index 14a21a3..42e9247 100644
--- a/libsoup/soup-content-sniffer-stream.c
+++ b/libsoup/soup-content-sniffer-stream.c
@@ -10,11 +10,9 @@
 #endif
 
 #include <string.h>
-#include <gio/gio.h>
 
 #include "soup-content-sniffer-stream.h"
-#include "soup-content-sniffer.h"
-#include "soup-message.h"
+#include "soup.h"
 
 static void soup_content_sniffer_stream_pollable_init (GPollableInputStreamInterface *pollable_interface, gpointer interface_data);
 
diff --git a/libsoup/soup-content-sniffer.c b/libsoup/soup-content-sniffer.c
index 4cf3864..b5fd125 100644
--- a/libsoup/soup-content-sniffer.c
+++ b/libsoup/soup-content-sniffer.c
@@ -12,11 +12,8 @@
 #include <string.h>
 
 #include "soup-content-sniffer.h"
-#include "soup-enum-types.h"
-#include "soup-message.h"
+#include "soup.h"
 #include "soup-message-private.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-content-sniffer
diff --git a/libsoup/soup-converter-wrapper.c b/libsoup/soup-converter-wrapper.c
index 3ca45ad..45d34a3 100644
--- a/libsoup/soup-converter-wrapper.c
+++ b/libsoup/soup-converter-wrapper.c
@@ -12,7 +12,7 @@
 #include <glib/gi18n-lib.h>
 
 #include "soup-converter-wrapper.h"
-#include "soup-message.h"
+#include "soup.h"
 
 /* SoupConverterWrapper is a GConverter that wraps another GConverter.
  * Mostly it is transparent, but it implements three special fallbacks
diff --git a/libsoup/soup-cookie-jar-sqlite.c b/libsoup/soup-cookie-jar-sqlite.c
index a0b6b79..97e6a0e 100644
--- a/libsoup/soup-cookie-jar-sqlite.c
+++ b/libsoup/soup-cookie-jar-sqlite.c
@@ -11,14 +11,12 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
+
 #include <sqlite3.h>
 
 #include "soup-cookie-jar-sqlite.h"
-#include "soup-cookie.h"
-#include "soup-date.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-cookie-jar-sqlite
diff --git a/libsoup/soup-cookie-jar-text.c b/libsoup/soup-cookie-jar-text.c
index 64f03dc..433c571 100644
--- a/libsoup/soup-cookie-jar-text.c
+++ b/libsoup/soup-cookie-jar-text.c
@@ -14,8 +14,7 @@
 #include <string.h>
 
 #include "soup-cookie-jar-text.h"
-#include "soup-cookie.h"
-#include "soup-date.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-cookie-jar-text
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index 2d47aab..433e704 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -9,18 +9,11 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
 #include <string.h>
 
-#include "soup-cookie.h"
 #include "soup-cookie-jar.h"
-#include "soup-date.h"
-#include "soup-enum-types.h"
+#include "soup.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
-#include "soup-session-feature.h"
-#include "soup-tld.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-cookie-jar
diff --git a/libsoup/soup-cookie.c b/libsoup/soup-cookie.c
index 7d6b583..c553c52 100755
--- a/libsoup/soup-cookie.c
+++ b/libsoup/soup-cookie.c
@@ -13,11 +13,7 @@
 #include <string.h>
 
 #include "soup-cookie.h"
-#include "soup-date.h"
-#include "soup-headers.h"
-#include "soup-message.h"
-#include "soup-message-headers.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-cookie
diff --git a/libsoup/soup-date.c b/libsoup/soup-date.c
index cf338e5..9973078 100644
--- a/libsoup/soup-date.c
+++ b/libsoup/soup-date.c
@@ -12,9 +12,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <glib.h>
 
 #include "soup-date.h"
+#include "soup.h"
 
 /**
  * SoupDate:
diff --git a/libsoup/soup-directory-input-stream.c b/libsoup/soup-directory-input-stream.c
index 3fe946b..eb8228a 100644
--- a/libsoup/soup-directory-input-stream.c
+++ b/libsoup/soup-directory-input-stream.c
@@ -23,12 +23,11 @@
 #include <config.h>
 #endif
 
-#include "soup-directory-input-stream.h"
-
-#include <libsoup/soup.h>
-#include <stdio.h>
 #include <string.h>
 
+#include "soup-directory-input-stream.h"
+#include "soup.h"
+
 #define INIT_STRING "<html>\n<body>\n<table><th align=\"left\">Name</th><th>Size</th><th>Date Modified</th>\n"
 #define ROW_FORMAT  "<td><a href=\"%s\">%s</a></td><td align=\"right\">%s</td><td align=\"right\" margin=8>%s</td>\n"
 #define EXIT_STRING "</table>\n</html>\n"
diff --git a/libsoup/soup-filter-input-stream.c b/libsoup/soup-filter-input-stream.c
index ba0137f..79159c3 100644
--- a/libsoup/soup-filter-input-stream.c
+++ b/libsoup/soup-filter-input-stream.c
@@ -9,11 +9,10 @@
 #include <config.h>
 #endif
 
-#include <stdlib.h>
 #include <string.h>
-#include <gio/gio.h>
 
 #include "soup-filter-input-stream.h"
+#include "soup.h"
 
 /* This is essentially a subset of GDataInputStream, except that we
  * can do the equivalent of "fill_nonblocking()" on it. (We could use
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c
index 3fe6578..5946dae 100644
--- a/libsoup/soup-form.c
+++ b/libsoup/soup-form.c
@@ -12,8 +12,7 @@
 #include <string.h>
 
 #include "soup-form.h"
-#include "soup-message.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-form
diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
index 5b85c71..ffa1e77 100644
--- a/libsoup/soup-headers.c
+++ b/libsoup/soup-headers.c
@@ -7,12 +7,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <stdio.h>
-#include <ctype.h>
 
 #include "soup-headers.h"
-#include "soup-misc.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /**
  * soup_headers_parse:
diff --git a/libsoup/soup-io-stream.c b/libsoup/soup-io-stream.c
index 3ade3db..74c7158 100644
--- a/libsoup/soup-io-stream.c
+++ b/libsoup/soup-io-stream.c
@@ -9,9 +9,8 @@
 #include <config.h>
 #endif
 
-#include <gio/gio.h>
-
 #include "soup-io-stream.h"
+#include "soup.h"
 #include "soup-filter-input-stream.h"
 
 struct _SoupIOStreamPrivate {
diff --git a/libsoup/soup-logger.c b/libsoup/soup-logger.c
index e68c4a8..3183cce 100644
--- a/libsoup/soup-logger.c
+++ b/libsoup/soup-logger.c
@@ -14,11 +14,7 @@
 #include <string.h>
 
 #include "soup-logger.h"
-#include "soup-message.h"
-#include "soup-session.h"
-#include "soup-session-feature.h"
-#include "soup-socket.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-logger
diff --git a/libsoup/soup-message-body.c b/libsoup/soup-message-body.c
index 6cff98d..0868d84 100644
--- a/libsoup/soup-message-body.c
+++ b/libsoup/soup-message-body.c
@@ -8,6 +8,7 @@
 #include <string.h>
 
 #include "soup-message-body.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-message-body
diff --git a/libsoup/soup-message-client-io.c b/libsoup/soup-message-client-io.c
index f6c752f..1310bb8 100644
--- a/libsoup/soup-message-client-io.c
+++ b/libsoup/soup-message-client-io.c
@@ -9,18 +9,13 @@
 #include "config.h"
 #endif
 
-#include <stdlib.h>
 #include <string.h>
 
+#include "soup.h"
 #include "soup-connection.h"
 #include "soup-message-private.h"
-#include "soup-auth.h"
-#include "soup-connection.h"
-#include "soup-headers.h"
 #include "soup-message-queue.h"
 #include "soup-misc-private.h"
-#include "soup-session-async.h"
-#include "soup-uri.h"
 
 static guint
 parse_response_headers (SoupMessage *req,
diff --git a/libsoup/soup-message-headers.c b/libsoup/soup-message-headers.c
index eb50034..6e396d1 100644
--- a/libsoup/soup-message-headers.c
+++ b/libsoup/soup-message-headers.c
@@ -5,12 +5,10 @@
  * Copyright (C) 2007, 2008 Red Hat, Inc.
  */
 
-#include <stdio.h>
 #include <string.h>
 
 #include "soup-message-headers.h"
-#include "soup-headers.h"
-#include "soup-misc.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-message-headers
@@ -753,8 +751,8 @@ soup_message_headers_set_content_length (SoupMessageHeaders *hdrs,
 {
 	char length[128];
 
-	snprintf (length, sizeof (length), "%" G_GUINT64_FORMAT,
-		  content_length);
+	g_snprintf (length, sizeof (length), "%" G_GUINT64_FORMAT,
+		    content_length);
 	soup_message_headers_remove (hdrs, "Transfer-Encoding");
 	soup_message_headers_replace (hdrs, "Content-Length", length);
 }
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 7a554df..42ddb7d 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -9,11 +9,9 @@
 #include "config.h"
 #endif
 
-#include <stdlib.h>
-#include <string.h>
-
 #include <glib/gi18n-lib.h>
 
+#include "soup.h"
 #include "soup-body-input-stream.h"
 #include "soup-body-output-stream.h"
 #include "soup-client-input-stream.h"
@@ -21,10 +19,8 @@
 #include "soup-content-sniffer-stream.h"
 #include "soup-converter-wrapper.h"
 #include "soup-filter-input-stream.h"
-#include "soup-message.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
-#include "soup-misc.h"
 #include "soup-misc-private.h"
 
 typedef enum {
diff --git a/libsoup/soup-message-queue.c b/libsoup/soup-message-queue.c
index 9715080..8ef129a 100644
--- a/libsoup/soup-message-queue.c
+++ b/libsoup/soup-message-queue.c
@@ -11,7 +11,7 @@
 #endif
 
 #include "soup-message-queue.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /* This is an internal structure used by #SoupSession and its
  * subclasses to keep track of the status of messages currently being
diff --git a/libsoup/soup-message-server-io.c b/libsoup/soup-message-server-io.c
index c40ace8..a53e5b7 100644
--- a/libsoup/soup-message-server-io.c
+++ b/libsoup/soup-message-server-io.c
@@ -9,17 +9,11 @@
 #include "config.h"
 #endif
 
-#include <stdlib.h>
 #include <string.h>
 
+#include "soup.h"
 #include "soup-message-private.h"
-#include "soup-address.h"
-#include "soup-auth.h"
-#include "soup-headers.h"
 #include "soup-misc-private.h"
-#include "soup-multipart.h"
-#include "soup-server.h"
-#include "soup-socket.h"
 
 static guint
 parse_request_headers (SoupMessage *msg, char *headers, guint headers_len,
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index eae697d..8a45395 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -5,19 +5,14 @@
  * Copyright (C) 2000-2003, Ximian, Inc.
  */
 
-#include <stdlib.h>
-#include <string.h>
+//#include <stdlib.h>
+//#include <string.h>
 
-#include "soup-address.h"
-#include "soup-auth.h"
+#include "soup-message.h"
+#include "soup.h"
 #include "soup-connection.h"
-#include "soup-enum-types.h"
 #include "soup-marshal.h"
-#include "soup-message.h"
 #include "soup-message-private.h"
-#include "soup-misc.h"
-#include "soup-socket.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-message
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c
index 5c09526..8354045 100644
--- a/libsoup/soup-misc.c
+++ b/libsoup/soup-misc.c
@@ -5,7 +5,6 @@
  * Copyright (C) 2000-2003, Ximian, Inc.
  */
 
-#include <ctype.h>
 #include <string.h>
 
 #include "soup-misc.h"
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index a88281f..aa0b04b 100644
--- a/libsoup/soup-multipart.c
+++ b/libsoup/soup-multipart.c
@@ -8,7 +8,7 @@
 #include <string.h>
 
 #include "soup-multipart.h"
-#include "soup-headers.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-multipart
diff --git a/libsoup/soup-password-manager-gnome.c b/libsoup/soup-password-manager-gnome.c
index bf36cb0..475cb59 100644
--- a/libsoup/soup-password-manager-gnome.c
+++ b/libsoup/soup-password-manager-gnome.c
@@ -9,14 +9,12 @@
 #include <config.h>
 #endif
 
+#include <gnome-keyring.h>
+
 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
 
 #include "soup-password-manager-gnome.h"
-#include "soup-auth.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
-
-#include <gnome-keyring.h>
+#include "soup.h"
 
 static void soup_password_manager_gnome_interface_init (SoupPasswordManagerInterface *password_manager_interface);
 
diff --git a/libsoup/soup-password-manager.c b/libsoup/soup-password-manager.c
index fed0156..3914179 100644
--- a/libsoup/soup-password-manager.c
+++ b/libsoup/soup-password-manager.c
@@ -12,7 +12,7 @@
 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
 
 #include "soup-password-manager.h"
-#include "soup-session-feature.h"
+#include "soup.h"
 
 G_DEFINE_INTERFACE_WITH_CODE (SoupPasswordManager, soup_password_manager, G_TYPE_OBJECT,
 			      g_type_interface_add_prerequisite (g_define_type_id, SOUP_TYPE_SESSION_FEATURE);
diff --git a/libsoup/soup-path-map.c b/libsoup/soup-path-map.c
index 60191b4..ca280df 100644
--- a/libsoup/soup-path-map.c
+++ b/libsoup/soup-path-map.c
@@ -5,9 +5,10 @@
  * Copyright (C) 2007 Novell, Inc.
  */
 
-#include "soup-path-map.h"
 #include <string.h>
 
+#include "soup-path-map.h"
+
 /* This could be replaced with something more clever, like a Patricia
  * trie, but it's probably not worth it since the total number of
  * mappings is likely to always be small. So we keep an array of
diff --git a/libsoup/soup-proxy-resolver-default.c b/libsoup/soup-proxy-resolver-default.c
index 8e33e8b..76e9ff6 100644
--- a/libsoup/soup-proxy-resolver-default.c
+++ b/libsoup/soup-proxy-resolver-default.c
@@ -9,13 +9,8 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-#include <stdlib.h>
-
 #include "soup-proxy-resolver-default.h"
-#include "soup-proxy-uri-resolver.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 /**
  * SoupProxyResolverDefault:
diff --git a/libsoup/soup-proxy-resolver-gnome.c b/libsoup/soup-proxy-resolver-gnome.c
index e01dd6a..bc42337 100644
--- a/libsoup/soup-proxy-resolver-gnome.c
+++ b/libsoup/soup-proxy-resolver-gnome.c
@@ -12,6 +12,7 @@
 #include <string.h>
 
 #include "soup-proxy-resolver-gnome.h"
+#include "soup.h"
 
 G_DEFINE_TYPE (SoupProxyResolverGNOME, soup_proxy_resolver_gnome, SOUP_TYPE_PROXY_RESOLVER_DEFAULT)
 
diff --git a/libsoup/soup-proxy-resolver-static.c b/libsoup/soup-proxy-resolver-static.c
index 93a833a..9432767 100644
--- a/libsoup/soup-proxy-resolver-static.c
+++ b/libsoup/soup-proxy-resolver-static.c
@@ -9,13 +9,8 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-
 #include "soup-proxy-resolver-static.h"
-#include "soup-address.h"
-#include "soup-message.h"
-#include "soup-misc.h"
-#include "soup-session-feature.h"
+#include "soup.h"
 
 typedef struct {
 	SoupURI *proxy_uri;
diff --git a/libsoup/soup-proxy-resolver.c b/libsoup/soup-proxy-resolver.c
index ca60411..8092175 100644
--- a/libsoup/soup-proxy-resolver.c
+++ b/libsoup/soup-proxy-resolver.c
@@ -10,11 +10,7 @@
 #endif
 
 #include "soup-proxy-resolver.h"
-#include "soup-proxy-uri-resolver.h"
-#include "soup-address.h"
-#include "soup-message.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
+#include "soup.h"
 
 static void soup_proxy_resolver_default_init (SoupProxyResolverInterface *iface);
 static void soup_proxy_resolver_uri_resolver_interface_init (SoupProxyURIResolverInterface *uri_resolver_interface);
diff --git a/libsoup/soup-proxy-uri-resolver.c b/libsoup/soup-proxy-uri-resolver.c
index 01f4f4f..8aecec4 100644
--- a/libsoup/soup-proxy-uri-resolver.c
+++ b/libsoup/soup-proxy-uri-resolver.c
@@ -10,7 +10,7 @@
 #endif
 
 #include "soup-proxy-uri-resolver.h"
-#include "soup-session-feature.h"
+#include "soup.h"
 
 G_DEFINE_INTERFACE (SoupProxyURIResolver, soup_proxy_uri_resolver, G_TYPE_OBJECT)
 
diff --git a/libsoup/soup-request-data.c b/libsoup/soup-request-data.c
index 8a2e065..933d752 100644
--- a/libsoup/soup-request-data.c
+++ b/libsoup/soup-request-data.c
@@ -25,14 +25,13 @@
 #include <config.h>
 #endif
 
+#include <glib/gi18n-lib.h>
+
 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-request-data.h"
-
-#include "soup-requester.h"
+#include "soup.h"
 #include "soup-misc-private.h"
-#include <libsoup/soup.h>
-#include <glib/gi18n.h>
 
 G_DEFINE_TYPE (SoupRequestData, soup_request_data, SOUP_TYPE_REQUEST)
 
diff --git a/libsoup/soup-request-file.c b/libsoup/soup-request-file.c
index 3c5ddc0..0b5638d 100644
--- a/libsoup/soup-request-file.c
+++ b/libsoup/soup-request-file.c
@@ -25,14 +25,14 @@
 #include <config.h>
 #endif
 
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
+#include <glib/gi18n-lib.h>
 
-#include <glib/gi18n.h>
+#define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-request-file.h"
+#include "soup.h"
 #include "soup-directory-input-stream.h"
 #include "soup-requester.h"
-#include "soup-uri.h"
 
 G_DEFINE_TYPE (SoupRequestFile, soup_request_file, SOUP_TYPE_REQUEST)
 
diff --git a/libsoup/soup-request-http.c b/libsoup/soup-request-http.c
index 9e7c945..319a591 100644
--- a/libsoup/soup-request-http.c
+++ b/libsoup/soup-request-http.c
@@ -25,17 +25,14 @@
 #include <config.h>
 #endif
 
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
 
 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-request-http.h"
-#include "soup-cache.h"
+#include "soup.h"
 #include "soup-cache-private.h"
-#include "soup-message.h"
-#include "soup-session.h"
 #include "soup-session-private.h"
-#include "soup-uri.h"
 
 G_DEFINE_TYPE (SoupRequestHTTP, soup_request_http, SOUP_TYPE_REQUEST)
 
diff --git a/libsoup/soup-request.c b/libsoup/soup-request.c
index df855ae..e7471c1 100644
--- a/libsoup/soup-request.c
+++ b/libsoup/soup-request.c
@@ -30,9 +30,8 @@
 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-request.h"
+#include "soup.h"
 #include "soup-requester.h"
-#include "soup-session.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-request
diff --git a/libsoup/soup-requester.c b/libsoup/soup-requester.c
index c3d1f32..281ebb1 100644
--- a/libsoup/soup-requester.c
+++ b/libsoup/soup-requester.c
@@ -27,11 +27,10 @@
 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
 
 #include "soup-requester.h"
+#include "soup.h"
 #include "soup-request-data.h"
 #include "soup-request-file.h"
 #include "soup-request-http.h"
-#include "soup-session-feature.h"
-#include "soup-uri.h"
 
 static SoupSessionFeatureInterface *soup_requester_default_feature_interface;
 static void soup_requester_session_feature_init (SoupSessionFeatureInterface *feature_interface, gpointer interface_data);
diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c
index 9ec1301..5dcafa1 100644
--- a/libsoup/soup-server.c
+++ b/libsoup/soup-server.c
@@ -9,21 +9,13 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "soup-server.h"
-#include "soup-address.h"
-#include "soup-auth-domain.h"
-#include "soup-date.h"
-#include "soup-form.h"
-#include "soup-headers.h"
+#include "soup.h"
 #include "soup-message-private.h"
 #include "soup-marshal.h"
 #include "soup-path-map.h" 
-#include "soup-socket.h"
 
 /**
  * SECTION:soup-server
diff --git a/libsoup/soup-session-async.c b/libsoup/soup-session-async.c
index 4073838..c9eda19 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -11,15 +11,11 @@
 
 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
 
-#include "soup-address.h"
 #include "soup-session-async.h"
+#include "soup.h"
 #include "soup-session-private.h"
-#include "soup-address.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
-#include "soup-misc.h"
-#include "soup-password-manager.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-session-async
diff --git a/libsoup/soup-session-feature.c b/libsoup/soup-session-feature.c
index 3728149..9f9b235 100644
--- a/libsoup/soup-session-feature.c
+++ b/libsoup/soup-session-feature.c
@@ -10,6 +10,7 @@
 #endif
 
 #include "soup-session-feature.h"
+#include "soup.h"
 #include "soup-message-private.h"
 
 /**
diff --git a/libsoup/soup-session-sync.c b/libsoup/soup-session-sync.c
index d8e2110..3ac290a 100644
--- a/libsoup/soup-session-sync.c
+++ b/libsoup/soup-session-sync.c
@@ -11,15 +11,11 @@
 
 #define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
 
-#include "soup-address.h"
 #include "soup-session-sync.h"
+#include "soup.h"
 #include "soup-session-private.h"
-#include "soup-address.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
-#include "soup-misc.h"
-#include "soup-password-manager.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-session-sync
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index a674f29..23f9e94 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -9,28 +9,17 @@
 #include <config.h>
 #endif
 
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-
 #include <glib/gi18n-lib.h>
 
-#include "soup-auth.h"
-#include "soup-auth-basic.h"
-#include "soup-auth-digest.h"
+#include "soup-session.h"
+#include "soup.h"
 #include "soup-auth-manager-ntlm.h"
 #include "soup-connection.h"
 #include "soup-marshal.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
-#include "soup-misc.h"
 #include "soup-proxy-resolver-static.h"
-#include "soup-proxy-uri-resolver.h"
-#include "soup-session.h"
-#include "soup-session-feature.h"
 #include "soup-session-private.h"
-#include "soup-socket.h"
-#include "soup-uri.h"
 
 #define HOST_KEEP_ALIVE 5 * 60 * 1000 /* 5 min in msecs */
 
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index 8899b48..2ac359d 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -9,21 +9,14 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "soup-socket.h"
-#include "soup-address.h"
+#include "soup.h"
 #include "soup-filter-input-stream.h"
 #include "soup-io-stream.h"
 #include "soup-marshal.h"
-#include "soup-misc.h"
 #include "soup-misc-private.h"
-#include "soup-uri.h"
 
 /**
  * SECTION:soup-socket
diff --git a/libsoup/soup-status.c b/libsoup/soup-status.c
index 2590a3d..7b048a8 100644
--- a/libsoup/soup-status.c
+++ b/libsoup/soup-status.c
@@ -5,11 +5,12 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#include "config.h"
-
-#include <glib.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include "soup-status.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-status
diff --git a/libsoup/soup-tld.c b/libsoup/soup-tld.c
index 5a8dad2..4dce00b 100644
--- a/libsoup/soup-tld.c
+++ b/libsoup/soup-tld.c
@@ -9,11 +9,12 @@
 #include <config.h>
 #endif
 
-#include <gio/gio.h>
-#include <glib/gi18n-lib.h>
 #include <string.h>
 
+#include <glib/gi18n-lib.h>
+
 #include "soup-tld.h"
+#include "soup.h"
 #include "soup-tld-private.h"
 
 static void soup_tld_ensure_rules_hash_table (void);
diff --git a/libsoup/soup-tld.h b/libsoup/soup-tld.h
index 5610d62..2d1eebd 100644
--- a/libsoup/soup-tld.h
+++ b/libsoup/soup-tld.h
@@ -6,6 +6,8 @@
 #ifndef __SOUP_TLD_H__
 #define __SOUP_TLD_H__
 
+#include <libsoup/soup-types.h>
+
 G_BEGIN_DECLS
 
 const char *soup_tld_get_base_domain         (const char *hostname,
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index c2fc434..f4422ce 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -5,14 +5,12 @@
  * Copyright 1999-2003 Ximian, Inc.
  */
 
-#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include "soup-uri.h"
+#include "soup.h"
 #include "soup-misc-private.h"
-#include "soup-form.h"
-#include "soup-misc.h"
 
 /**
  * SECTION:soup-uri
diff --git a/libsoup/soup-value-utils.c b/libsoup/soup-value-utils.c
index d9f6bdc..b929544 100644
--- a/libsoup/soup-value-utils.c
+++ b/libsoup/soup-value-utils.c
@@ -5,10 +5,14 @@
  * Copyright (C) 2007 Red Hat, Inc.
  */
 
-#include "soup-value-utils.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 
+#include "soup-value-utils.h"
+
 /**
  * SECTION:soup-value-utils
  * @short_description: #GValue utilities
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index 49eced6..f790858 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -10,16 +10,11 @@
 #endif
 
 #include <string.h>
-#include <time.h>
 
 #include <libxml/tree.h>
 
 #include "soup-xmlrpc.h"
-#include "soup-value-utils.h"
-#include "soup-date.h"
-#include "soup-message.h"
-#include "soup-misc.h"
-#include "soup-session.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-xmlrpc
diff --git a/tests/auth-test.c b/tests/auth-test.c
index 3bbee87..85c4d41 100644
--- a/tests/auth-test.c
+++ b/tests/auth-test.c
@@ -1,16 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libsoup/soup.h"
-#include "libsoup/soup-auth.h"
-#include "libsoup/soup-session.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
@@ -1136,7 +1124,7 @@ do_batch_tests (const gchar *base_uri_str, gint ntests)
 		msg = soup_message_new_from_uri (SOUP_METHOD_GET, soup_uri);
 		soup_uri_free (soup_uri);
 		if (!msg) {
-			fprintf (stderr, "auth-test: Could not parse URI\n");
+			g_printerr ("auth-test: Could not parse URI\n");
 			exit (1);
 		}
 
diff --git a/tests/chunk-test.c b/tests/chunk-test.c
index c3eecc4..cce7127 100644
--- a/tests/chunk-test.c
+++ b/tests/chunk-test.c
@@ -3,15 +3,6 @@
  * Copyright (C) 2008 Red Hat, Inc.
  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 typedef struct {
diff --git a/tests/coding-test.c b/tests/coding-test.c
index ea8b857..47f5d08 100644
--- a/tests/coding-test.c
+++ b/tests/coding-test.c
@@ -4,23 +4,6 @@
  * Copyright (C) 2011 Igalia, S.L.
  */
 
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
-
 #include "test-utils.h"
 
 SoupServer *server;
diff --git a/tests/connection-test.c b/tests/connection-test.c
index 7c6fb5a..ee2a78b 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -3,10 +3,6 @@
  * Copyright 2007-2012 Red Hat, Inc.
  */
 
-#include <string.h>
-
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 SoupServer *server;
diff --git a/tests/context-test.c b/tests/context-test.c
index 673ae21..97cd2c0 100644
--- a/tests/context-test.c
+++ b/tests/context-test.c
@@ -3,24 +3,6 @@
  * Copyright (C) 2007 Red Hat, Inc.
  */
 
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <libsoup/soup-address.h>
-#include <libsoup/soup-message.h>
-#include <libsoup/soup-misc.h>
-#include <libsoup/soup-server.h>
-#include <libsoup/soup-session-async.h>
-#include <libsoup/soup-session-sync.h>
-
 #include "test-utils.h"
 
 static char *base_uri;
diff --git a/tests/continue-test.c b/tests/continue-test.c
index dafe182..fa9ef80 100644
--- a/tests/continue-test.c
+++ b/tests/continue-test.c
@@ -3,15 +3,6 @@
  * Copyright (C) 2007 Novell, Inc.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <libsoup/soup.h>
-#include <libsoup/soup-auth-domain-basic.h>
-#include <libsoup/soup-server.h>
-
 #include "test-utils.h"
 
 #define SHORT_BODY "This is a test.\r\n"
diff --git a/tests/cookies-test.c b/tests/cookies-test.c
index 87f4673..58f8052 100644
--- a/tests/cookies-test.c
+++ b/tests/cookies-test.c
@@ -3,11 +3,6 @@
  * Copyright (C) 2010 Igalia S.L.
  */
 
-#include <string.h>
-
-#include <glib.h>
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 SoupServer *server;
diff --git a/tests/date.c b/tests/date.c
index 5b3ec34..54a59f2 100644
--- a/tests/date.c
+++ b/tests/date.c
@@ -3,12 +3,6 @@
  * Copyright (C) 2005 Novell, Inc.
  */
 
-#include <stdio.h>
-#include <string.h>
-
-#include <libsoup/soup-date.h>
-#include <glib.h>
-
 #include "test-utils.h"
 
 static gboolean check_ok (const char *strdate, SoupDate *date);
diff --git a/tests/dns.c b/tests/dns.c
index 1751cfb..f594064 100644
--- a/tests/dns.c
+++ b/tests/dns.c
@@ -1,9 +1,6 @@
-#include <config.h>
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libsoup/soup-address.h"
+#include "test-utils.h"
 
 static GMainLoop *loop;
 static int nlookups = 0;
@@ -12,13 +9,13 @@ static void
 resolve_callback (SoupAddress *addr, guint status, gpointer data)
 {
 	if (status == SOUP_STATUS_OK) {
-		printf ("Name:    %s\n", soup_address_get_name (addr));
-		printf ("Address: %s\n", soup_address_get_physical (addr));
+		g_print ("Name:    %s\n", soup_address_get_name (addr));
+		g_print ("Address: %s\n", soup_address_get_physical (addr));
 	} else {
-		printf ("Name:    %s\n", soup_address_get_name (addr));
-		printf ("Error:   %s\n", soup_status_get_phrase (status));
+		g_print ("Name:    %s\n", soup_address_get_name (addr));
+		g_print ("Error:   %s\n", soup_status_get_phrase (status));
 	}
-	printf ("\n");
+	g_print ("\n");
 
 	g_object_unref (addr);
 
@@ -30,7 +27,7 @@ resolve_callback (SoupAddress *addr, guint status, gpointer data)
 static void
 usage (void)
 {
-	fprintf (stderr, "Usage: dns hostname ...\n");
+	g_printerr ("Usage: dns hostname ...\n");
 	exit (1);
 }
 
@@ -48,7 +45,7 @@ main (int argc, char **argv)
 	for (i = 1; i < argc; i++) {
 		addr = soup_address_new (argv[i], 0);
 		if (!addr) {
-			fprintf (stderr, "Could not parse address %s\n", argv[1]);
+			g_printerr ("Could not parse address %s\n", argv[1]);
 			exit (1);
 		}
 
diff --git a/tests/forms-test.c b/tests/forms-test.c
index fbbd97c..1d254b1 100644
--- a/tests/forms-test.c
+++ b/tests/forms-test.c
@@ -3,22 +3,6 @@
  * Copyright (C) 2007, 2008 Red Hat, Inc.
  */
 
-#include "config.h"
-
-#include <ctype.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 static struct {
@@ -441,7 +425,7 @@ main (int argc, char **argv)
 				 hello_callback, NULL, NULL);
 	soup_server_add_handler (server, "/md5",
 				 md5_callback, NULL, NULL);
-	port = 	soup_server_get_port (server);
+	port = soup_server_get_port (server);
 
 	loop = g_main_loop_new (NULL, TRUE);
 
@@ -456,7 +440,7 @@ main (int argc, char **argv)
 
 		do_form_decode_test ();
 	} else {
-		printf ("Listening on port %d\n", port);
+		g_print ("Listening on port %d\n", port);
 		g_main_loop_run (loop);
 	}
 
diff --git a/tests/get.c b/tests/get.c
index d3b6eac..1d86715 100644
--- a/tests/get.c
+++ b/tests/get.c
@@ -3,20 +3,8 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
+#include "test-utils.h"
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <libsoup/soup.h>
 
 static SoupSession *session;
 static GMainLoop *loop;
@@ -42,30 +30,30 @@ get_url (const char *url)
 		const char *hname, *value;
 		char *path = soup_uri_to_string (soup_message_get_uri (msg), TRUE);
 
-		printf ("%s %s HTTP/1.%d\n", method, path,
-			soup_message_get_http_version (msg));
+		g_print ("%s %s HTTP/1.%d\n", method, path,
+			 soup_message_get_http_version (msg));
 		soup_message_headers_iter_init (&iter, msg->request_headers);
 		while (soup_message_headers_iter_next (&iter, &hname, &value))
-			printf ("%s: %s\r\n", hname, value);
-		printf ("\n");
+			g_print ("%s: %s\r\n", hname, value);
+		g_print ("\n");
 
-		printf ("HTTP/1.%d %d %s\n",
-			soup_message_get_http_version (msg),
-			msg->status_code, msg->reason_phrase);
+		g_print ("HTTP/1.%d %d %s\n",
+			 soup_message_get_http_version (msg),
+			 msg->status_code, msg->reason_phrase);
 
 		soup_message_headers_iter_init (&iter, msg->response_headers);
 		while (soup_message_headers_iter_next (&iter, &hname, &value))
-			printf ("%s: %s\r\n", hname, value);
-		printf ("\n");
+			g_print ("%s: %s\r\n", hname, value);
+		g_print ("\n");
 	} else if (msg->status_code == SOUP_STATUS_SSL_FAILED) {
 		GTlsCertificateFlags flags;
 
 		if (soup_message_get_https_status (msg, NULL, &flags))
-			printf ("%s: %d %s (0x%x)\n", name, msg->status_code, msg->reason_phrase, flags);
+			g_print ("%s: %d %s (0x%x)\n", name, msg->status_code, msg->reason_phrase, flags);
 		else
-			printf ("%s: %d %s (no handshake status)\n", name, msg->status_code, msg->reason_phrase);
+			g_print ("%s: %d %s (no handshake status)\n", name, msg->status_code, msg->reason_phrase);
 	} else if (!quiet || SOUP_STATUS_IS_TRANSPORT_ERROR (msg->status_code))
-		printf ("%s: %d %s\n", name, msg->status_code, msg->reason_phrase);
+		g_print ("%s: %d %s\n", name, msg->status_code, msg->reason_phrase);
 
 	if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
 		header = soup_message_headers_get_one (msg->response_headers,
@@ -75,7 +63,7 @@ get_url (const char *url)
 			char *uri_string;
 
 			if (!debug && !quiet)
-				printf ("  -> %s\n", header);
+				g_print ("  -> %s\n", header);
 
 			uri = soup_uri_new_with_base (soup_message_get_uri (msg), header);
 			uri_string = soup_uri_to_string (uri, FALSE);
@@ -92,7 +80,7 @@ get_url (const char *url)
 static void
 usage (void)
 {
-	fprintf (stderr, "Usage: get [-c CAfile] [-p proxy URL] [-h] [-d] URL\n");
+	g_printerr ("Usage: get [-c CAfile] [-p proxy URL] [-h] [-d] URL\n");
 	exit (1);
 }
 
@@ -130,8 +118,8 @@ main (int argc, char **argv)
 		case 'p':
 			proxy = soup_uri_new (optarg);
 			if (!proxy) {
-				fprintf (stderr, "Could not parse %s as URI\n",
-					 optarg);
+				g_printerr ("Could not parse %s as URI\n",
+					    optarg);
 				exit (1);
 			}
 			break;
@@ -157,7 +145,7 @@ main (int argc, char **argv)
 	url = argv[0];
 	parsed = soup_uri_new (url);
 	if (!parsed) {
-		fprintf (stderr, "Could not parse '%s' as a URL\n", url);
+		g_printerr ("Could not parse '%s' as a URL\n", url);
 		exit (1);
 	}
 	soup_uri_free (parsed);
diff --git a/tests/header-parsing.c b/tests/header-parsing.c
index fcdd550..e57d7d8 100644
--- a/tests/header-parsing.c
+++ b/tests/header-parsing.c
@@ -1,10 +1,4 @@
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <libsoup/soup.h>
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
diff --git a/tests/misc-test.c b/tests/misc-test.c
index a2b9937..9d75a9c 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -3,12 +3,6 @@
  * Copyright 2007-2012 Red Hat, Inc.
  */
 
-#include <string.h>
-
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-
 #include "test-utils.h"
 
 SoupServer *server, *ssl_server;
diff --git a/tests/ntlm-test.c b/tests/ntlm-test.c
index f5462c6..00222e8 100644
--- a/tests/ntlm-test.c
+++ b/tests/ntlm-test.c
@@ -9,23 +9,6 @@
  * set in the right messages.
  */
 
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <libsoup/soup-address.h>
-#include <libsoup/soup-auth.h>
-#include <libsoup/soup-message.h>
-#include <libsoup/soup-server.h>
-#include <libsoup/soup-session-async.h>
-
 #include "test-utils.h"
 
 typedef enum {
diff --git a/tests/proxy-test.c b/tests/proxy-test.c
index 62bbd99..cebc839 100644
--- a/tests/proxy-test.c
+++ b/tests/proxy-test.c
@@ -1,18 +1,5 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
 #include "test-utils.h"
 
 typedef struct {
@@ -121,7 +108,7 @@ test_url (const char *url, int proxy, guint expected,
 
 	msg = soup_message_new (SOUP_METHOD_GET, url);
 	if (!msg) {
-		fprintf (stderr, "proxy-test: Could not parse URI\n");
+		g_printerr ("proxy-test: Could not parse URI\n");
 		exit (1);
 	}
 
diff --git a/tests/pull-api.c b/tests/pull-api.c
index febe490..512d176 100644
--- a/tests/pull-api.c
+++ b/tests/pull-api.c
@@ -1,15 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libsoup/soup.h"
-#include "libsoup/soup-session.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
@@ -33,8 +22,8 @@ get_correct_response (const char *uri)
 	msg = soup_message_new (SOUP_METHOD_GET, uri);
 	soup_session_send_message (session, msg);
 	if (msg->status_code != SOUP_STATUS_OK) {
-		fprintf (stderr, "Could not fetch %s: %d %s\n", uri,
-			 msg->status_code, msg->reason_phrase);
+		g_printerr ("Could not fetch %s: %d %s\n", uri,
+			    msg->status_code, msg->reason_phrase);
 		exit (1);
 	}
 
diff --git a/tests/range-test.c b/tests/range-test.c
index d7ba922..98f5645 100644
--- a/tests/range-test.c
+++ b/tests/range-test.c
@@ -1,14 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libsoup/soup.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
@@ -24,8 +14,8 @@ get_full_response (void)
 	GError *error = NULL;
 
 	if (!g_file_get_contents (SRCDIR "/index.txt", &contents, &length, &error)) {
-		fprintf (stderr, "Could not read index.txt: %s\n",
-			 error->message);
+		g_printerr ("Could not read index.txt: %s\n",
+			    error->message);
 		exit (1);
 	}
 
diff --git a/tests/redirect-test.c b/tests/redirect-test.c
index cf294c4..45166e6 100644
--- a/tests/redirect-test.c
+++ b/tests/redirect-test.c
@@ -3,19 +3,6 @@
  * Copyright (C) 2008 Red Hat, Inc.
  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
-
 #include "test-utils.h"
 
 char *server2_uri;
@@ -624,7 +611,7 @@ main (int argc, char **argv)
 		do_connection_test (base_uri);
 		soup_uri_free (base_uri);
 	} else {
-		printf ("Listening on port %d\n", port);
+		g_print ("Listening on port %d\n", port);
 		g_main_loop_run (loop);
 	}
 
diff --git a/tests/requester-test.c b/tests/requester-test.c
index 4da46ab..b4e86ea 100644
--- a/tests/requester-test.c
+++ b/tests/requester-test.c
@@ -3,15 +3,6 @@
  * Copyright (C) 2011 Red Hat, Inc.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define LIBSOUP_USE_UNSTABLE_REQUEST_API
-#include <libsoup/soup.h>
-#include <libsoup/soup-requester.h>
-#include <libsoup/soup-request-http.h>
-
 #include "test-utils.h"
 
 SoupServer *server;
@@ -31,8 +22,8 @@ get_index (void)
 	GError *error = NULL;
 
 	if (!g_file_get_contents (SRCDIR "/index.txt", &contents, &length, &error)) {
-		fprintf (stderr, "Could not read index.txt: %s\n",
-			 error->message);
+		g_printerr ("Could not read index.txt: %s\n",
+			    error->message);
 		exit (1);
 	}
 
diff --git a/tests/server-auth-test.c b/tests/server-auth-test.c
index 89e5943..757e065 100644
--- a/tests/server-auth-test.c
+++ b/tests/server-auth-test.c
@@ -3,26 +3,6 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#include "config.h"
-
-#include <ctype.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <libsoup/soup-address.h>
-#include <libsoup/soup-auth-domain-basic.h>
-#include <libsoup/soup-auth-domain-digest.h>
-#include <libsoup/soup-message.h>
-#include <libsoup/soup-server.h>
-
 #include "test-utils.h"
 
 static struct {
@@ -370,7 +350,7 @@ main (int argc, char **argv)
 		do_auth_tests (uri);
 		soup_uri_free (uri);
 	} else {
-		printf ("Listening on port %d\n", soup_server_get_port (server));
+		g_print ("Listening on port %d\n", soup_server_get_port (server));
 		g_main_loop_run (loop);
 	}
 
diff --git a/tests/simple-httpd.c b/tests/simple-httpd.c
index ab88bf9..46f0988 100644
--- a/tests/simple-httpd.c
+++ b/tests/simple-httpd.c
@@ -3,25 +3,18 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#include "config.h"
+#include "test-utils.h"
 
-#include <ctype.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <errno.h>
-#include <signal.h>
+#include <fcntl.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
 
-#include <libsoup/soup.h>
-
 #ifdef HAVE_MMAP
 struct mapping {
 	void   *start;
@@ -224,13 +217,13 @@ server_callback (SoupServer *server, SoupMessage *msg,
 	SoupMessageHeadersIter iter;
 	const char *name, *value;
 
-	printf ("%s %s HTTP/1.%d\n", msg->method, path,
-		soup_message_get_http_version (msg));
+	g_print ("%s %s HTTP/1.%d\n", msg->method, path,
+		 soup_message_get_http_version (msg));
 	soup_message_headers_iter_init (&iter, msg->request_headers);
 	while (soup_message_headers_iter_next (&iter, &name, &value))
-		printf ("%s: %s\n", name, value);
+		g_print ("%s: %s\n", name, value);
 	if (msg->request_body->length)
-		printf ("%s\n", msg->request_body->data);
+		g_print ("%s\n", msg->request_body->data);
 
 	file_path = g_strdup_printf (".%s", path);
 
@@ -242,7 +235,7 @@ server_callback (SoupServer *server, SoupMessage *msg,
 		soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
 
 	g_free (file_path);
-	printf ("  -> %d %s\n\n", msg->status_code, msg->reason_phrase);
+	g_print ("  -> %d %s\n\n", msg->status_code, msg->reason_phrase);
 }
 
 static void
@@ -280,8 +273,8 @@ main (int argc, char **argv)
 			ssl_port = atoi (optarg);
 			break;
 		default:
-			fprintf (stderr, "Usage: %s [-p port] [-c ssl-cert-file -k ssl-key-file [-s ssl-port]]\n",
-				 argv[0]);
+			g_printerr ("Usage: %s [-p port] [-c ssl-cert-file -k ssl-key-file [-s ssl-port]]\n",
+				    argv[0]);
 			exit (1);
 		}
 	}
@@ -290,13 +283,13 @@ main (int argc, char **argv)
 				  SOUP_SERVER_SERVER_HEADER, "simple-httpd ",
 				  NULL);
 	if (!server) {
-		fprintf (stderr, "Unable to bind to server port %d\n", port);
+		g_printerr ("Unable to bind to server port %d\n", port);
 		exit (1);
 	}
 	soup_server_add_handler (server, NULL,
 				 server_callback, NULL, NULL);
-	printf ("\nStarting Server on port %d\n",
-		soup_server_get_port (server));
+	g_print ("\nStarting Server on port %d\n",
+		 soup_server_get_port (server));
 	soup_server_run_async (server);
 
 	if (ssl_cert_file && ssl_key_file) {
@@ -307,17 +300,17 @@ main (int argc, char **argv)
 			NULL);
 
 		if (!ssl_server) {
-			fprintf (stderr, "Unable to bind to SSL server port %d\n", ssl_port);
+			g_printerr ("Unable to bind to SSL server port %d\n", ssl_port);
 			exit (1);
 		}
 		soup_server_add_handler (ssl_server, NULL,
 					 server_callback, NULL, NULL);
-		printf ("Starting SSL Server on port %d\n", 
-			soup_server_get_port (ssl_server));
+		g_print ("Starting SSL Server on port %d\n", 
+			 soup_server_get_port (ssl_server));
 		soup_server_run_async (ssl_server);
 	}
 
-	printf ("\nWaiting for requests...\n");
+	g_print ("\nWaiting for requests...\n");
 
 	loop = g_main_loop_new (NULL, TRUE);
 	g_main_loop_run (loop);
diff --git a/tests/simple-proxy.c b/tests/simple-proxy.c
index 52c2412..f25f9a0 100644
--- a/tests/simple-proxy.c
+++ b/tests/simple-proxy.c
@@ -3,18 +3,7 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <glib.h>
-#include <libsoup/soup.h>
+#include "test-utils.h"
 
 /* WARNING: this is really really really not especially compliant with
  * RFC 2616. But it does work for basic stuff.
@@ -32,9 +21,9 @@ copy_header (const char *name, const char *value, gpointer dest_headers)
 static void
 send_headers (SoupMessage *from, SoupMessage *to)
 {
-	printf ("[%p] HTTP/1.%d %d %s\n", to,
-		soup_message_get_http_version (from),
-		from->status_code, from->reason_phrase);
+	g_print ("[%p] HTTP/1.%d %d %s\n", to,
+		 soup_message_get_http_version (from),
+		 from->status_code, from->reason_phrase);
 
 	soup_message_set_status_full (to, from->status_code,
 				      from->reason_phrase);
@@ -47,8 +36,8 @@ send_headers (SoupMessage *from, SoupMessage *to)
 static void
 send_chunk (SoupMessage *from, SoupBuffer *chunk, SoupMessage *to)
 {
-	printf ("[%p]   writing chunk of %lu bytes\n", to,
-		(unsigned long)chunk->length);
+	g_print ("[%p]   writing chunk of %lu bytes\n", to,
+		 (unsigned long)chunk->length);
 
 	soup_message_body_append_buffer (to->response_body, chunk);
 	soup_server_unpause_message (server, to);
@@ -65,7 +54,7 @@ finish_msg (SoupSession *session, SoupMessage *msg2, gpointer data)
 {
 	SoupMessage *msg = data;
 
-	printf ("[%p]   done\n\n", msg);
+	g_print ("[%p]   done\n\n", msg);
 	g_signal_handlers_disconnect_by_func (msg, client_msg_failed, msg2);
 
 	soup_message_body_complete (msg->response_body);
@@ -82,8 +71,8 @@ server_callback (SoupServer *server, SoupMessage *msg,
 	char *uristr;
 
 	uristr = soup_uri_to_string (soup_message_get_uri (msg), FALSE);
-	printf ("[%p] %s %s HTTP/1.%d\n", msg, msg->method, uristr,
-		soup_message_get_http_version (msg));
+	g_print ("[%p] %s %s HTTP/1.%d\n", msg, msg->method, uristr,
+		 soup_message_get_http_version (msg));
 
 	if (msg->method == SOUP_METHOD_CONNECT) {
 		soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED);
@@ -155,8 +144,8 @@ main (int argc, char **argv)
 			port = atoi (optarg);
 			break;
 		default:
-			fprintf (stderr, "Usage: %s [-p port] [-n]\n",
-				 argv[0]);
+			g_printerr ("Usage: %s [-p port] [-n]\n",
+				    argv[0]);
 			exit (1);
 		}
 	}
@@ -164,7 +153,7 @@ main (int argc, char **argv)
 	server = soup_server_new (SOUP_SERVER_PORT, port,
 				  NULL);
 	if (!server) {
-		fprintf (stderr, "Unable to bind to server port %d\n", port);
+		g_printerr ("Unable to bind to server port %d\n", port);
 		exit (1);
 	}
 	soup_server_add_handler (server, NULL,
@@ -174,13 +163,13 @@ main (int argc, char **argv)
 		g_object_unref (auth_domain);
 	}
 
-	printf ("\nStarting proxy on port %d\n",
-		soup_server_get_port (server));
+	g_print ("\nStarting proxy on port %d\n",
+		 soup_server_get_port (server));
 	soup_server_run_async (server);
 
 	session = soup_session_async_new ();
 
-	printf ("\nWaiting for requests...\n");
+	g_print ("\nWaiting for requests...\n");
 
 	loop = g_main_loop_new (NULL, TRUE);
 	g_main_loop_run (loop);
diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c
index 2812334..dd4eb4a 100644
--- a/tests/sniffing-test.c
+++ b/tests/sniffing-test.c
@@ -3,12 +3,6 @@
  * Copyright (C) 2009 Gustavo Noronha Silva <gns gnome org>.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 SoupSession *session;
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index f999d82..6d96bc7 100644
--- a/tests/ssl-test.c
+++ b/tests/ssl-test.c
@@ -1,8 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "libsoup/soup.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
diff --git a/tests/streaming-test.c b/tests/streaming-test.c
index 869a7b6..239e0ce 100644
--- a/tests/streaming-test.c
+++ b/tests/streaming-test.c
@@ -3,15 +3,6 @@
  * Copyright (C) 2008 Red Hat, Inc.
  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 #define RESPONSE_CHUNK_SIZE 1024
@@ -28,8 +19,8 @@ get_full_response (void)
 				  &full_response,
 				  &full_response_length,
 				  &error)) {
-		fprintf (stderr, "Could not read index file %s: %s\n",
-			 SRCDIR "/index.txt", error->message);
+		g_printerr ("Could not read index file %s: %s\n",
+			    SRCDIR "/index.txt", error->message);
 		g_error_free (error);
 		exit (1);
 	}
diff --git a/tests/test-utils.c b/tests/test-utils.c
index fee671a..f2a3bd6 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -1,16 +1,11 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
-#include "libsoup/soup.h"
+
+#include <glib/gprintf.h>
 
 #include <locale.h>
 #include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 #ifdef HAVE_APACHE
 static gboolean apache_running;
@@ -98,10 +93,10 @@ test_init (int argc, char **argv, GOptionEntry *entries)
 		g_option_context_add_main_entries (opts, entries, NULL);
 
 	if (!g_option_context_parse (opts, &argc, &argv, &error)) {
-		fprintf (stderr, "Could not parse arguments: %s\n",
-			 error->message);
-		fprintf (stderr, "%s",
-			 g_option_context_get_help (opts, TRUE, NULL));
+		g_printerr ("Could not parse arguments: %s\n",
+			    error->message);
+		g_printerr ("%s",
+			    g_option_context_get_help (opts, TRUE, NULL));
 		exit (1);
 	}
 	g_option_context_free (opts);
@@ -130,11 +125,11 @@ test_cleanup (void)
 
 	debug_printf (1, "\n");
 	if (errors) {
-		printf ("%s: %d error(s).%s\n",
-			g_get_prgname (), errors,
-			debug_level == 0 ? " Run with '-d' for details" : "");
+		g_print ("%s: %d error(s).%s\n",
+			 g_get_prgname (), errors,
+			 debug_level == 0 ? " Run with '-d' for details" : "");
 	} else
-		printf ("%s: OK\n", g_get_prgname ());
+		g_print ("%s: OK\n", g_get_prgname ());
 }
 
 void
@@ -146,7 +141,7 @@ debug_printf (int level, const char *format, ...)
 		return;
 
 	va_start (args, format);
-	vprintf (format, args);
+	g_vprintf (format, args);
 	va_end (args);
 }
 
@@ -187,7 +182,7 @@ void
 apache_init (void)
 {
 	if (!apache_cmd ("start")) {
-		fprintf (stderr, "Could not start apache\n");
+		g_printerr ("Could not start apache\n");
 		exit (1);
 	}
 	apache_running = TRUE;
@@ -291,7 +286,7 @@ test_server_new (gboolean in_own_thread, gboolean ssl)
 		g_main_context_unref (async_context);
 
 	if (!server) {
-		fprintf (stderr, "Unable to create server\n");
+		g_printerr ("Unable to create server\n");
 		exit (1);
 	}
 
diff --git a/tests/test-utils.h b/tests/test-utils.h
index 98c12fd..78f7e48 100644
--- a/tests/test-utils.h
+++ b/tests/test-utils.h
@@ -2,7 +2,16 @@
 #include "config.h"
 #endif
 
-#include "libsoup/soup-types.h"
+#include <string.h>
+#include <stdlib.h>
+
+#define LIBSOUP_USE_UNSTABLE_REQUEST_API
+
+#include "libsoup/soup.h"
+#include "libsoup/soup-requester.h"
+#include "libsoup/soup-request-data.h"
+#include "libsoup/soup-request-file.h"
+#include "libsoup/soup-request-http.h"
 
 void test_init    (int argc, char **argv, GOptionEntry *entries);
 void test_cleanup (void);
diff --git a/tests/timeout-test.c b/tests/timeout-test.c
index 4cde526..2bb91d8 100644
--- a/tests/timeout-test.c
+++ b/tests/timeout-test.c
@@ -1,14 +1,4 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libsoup/soup.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
diff --git a/tests/tld-test.c b/tests/tld-test.c
index 7be0ae7..5952444 100644
--- a/tests/tld-test.c
+++ b/tests/tld-test.c
@@ -3,10 +3,6 @@
  * Copyright (C) 2012 Igalia S.L.
  */
 
-#include <glib.h>
-#include <libsoup/soup.h>
-#include <string.h>
-
 #include "test-utils.h"
 
 /* From http://publicsuffix.org/list/test.txt */
diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c
index fb04144..124dfe9 100644
--- a/tests/uri-parsing.c
+++ b/tests/uri-parsing.c
@@ -1,12 +1,4 @@
-#include <config.h>
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libsoup/soup-uri.h"
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include "test-utils.h"
 
@@ -524,14 +516,14 @@ main (int argc, char **argv)
 	debug_printf (1, "\nRelative URI parsing\n");
 	base_uri = soup_uri_new (base);
 	if (!base_uri) {
-		fprintf (stderr, "Could not parse %s!\n", base);
+		g_printerr ("Could not parse %s!\n", base);
 		exit (1);
 	}
 
 	uri_string = soup_uri_to_string (base_uri, FALSE);
 	if (strcmp (uri_string, base) != 0) {
-		fprintf (stderr, "URI <%s> unparses to <%s>\n",
-			 base, uri_string);
+		g_printerr ("URI <%s> unparses to <%s>\n",
+			    base, uri_string);
 		errors++;
 	}
 	g_free (uri_string);
diff --git a/tests/xmlrpc-server-test.c b/tests/xmlrpc-server-test.c
index ebb7ca6..8ad2187 100644
--- a/tests/xmlrpc-server-test.c
+++ b/tests/xmlrpc-server-test.c
@@ -3,14 +3,6 @@
  * Copyright (C) 2008 Red Hat, Inc.
  */
 
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/wait.h>
-
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 #ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@@ -254,7 +246,7 @@ xmlrpc_test_print (GIOChannel *io, GIOCondition cond, gpointer data)
 	if (status == G_IO_STATUS_NORMAL) {
 		/* Don't print the exit status, just the debug stuff */
 		if (strncmp (line, "xmlrpc-test:", strlen ("xmlrpc-test:")) != 0)
-			printf ("%s", line);
+			g_print ("%s", line);
 		g_free (line);
 		return TRUE;
 	} else if (status == G_IO_STATUS_AGAIN)
@@ -290,7 +282,7 @@ do_xmlrpc_tests (SoupURI *uri)
 	g_free (argv[3]);
 
 	if (!ok) {
-		printf ("Could not run xmlrpc-test: %s\n", error->message);
+		g_print ("Could not run xmlrpc-test: %s\n", error->message);
 		errors++;
 		return;
 	}
@@ -331,7 +323,7 @@ main (int argc, char **argv)
 		do_xmlrpc_tests (uri);
 		soup_uri_free (uri);
 	} else
-		printf ("Listening on port %d\n", soup_server_get_port (server));
+		g_print ("Listening on port %d\n", soup_server_get_port (server));
 
 	g_main_loop_run (loop);
 	g_main_loop_unref (loop);
diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c
index f442e2c..ec67e4d 100644
--- a/tests/xmlrpc-test.c
+++ b/tests/xmlrpc-test.c
@@ -3,13 +3,6 @@
  * Copyright (C) 2001-2003, Ximian, Inc.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 #ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@@ -109,7 +102,7 @@ test_sum (void)
 
 	ints = g_value_array_new (10);
 	for (i = sum = 0; i < 10; i++) {
-		val = rand () % 100;
+		val = g_random_int_range (0, 100);
 		debug_printf (2, "%s%d", i == 0 ? "[" : ", ", val);
 		soup_value_array_append (ints, G_TYPE_INT, val);
 		sum += val;
@@ -144,7 +137,7 @@ test_countBools (void)
 
 	bools = g_value_array_new (10);
 	for (i = trues = falses = 0; i < 10; i++) {
-		val = rand () > (RAND_MAX / 2);
+		val = g_random_boolean ();
 		debug_printf (2, "%s%c", i == 0 ? "[" : ", ", val ? 'T' : 'F');
 		soup_value_array_append (bools, G_TYPE_BOOLEAN, val);
 		if (val)
@@ -194,7 +187,7 @@ test_md5sum (void)
 	data = g_byte_array_new ();
 	g_byte_array_set_size (data, 256);
 	for (i = 0; i < data->len; i++)
-		data->data[i] = (char)(rand ());
+		data->data[i] = (char)(g_random_int_range (0, 256));
 
 	checksum = g_checksum_new (G_CHECKSUM_MD5);
 	g_checksum_update (checksum, data->data, data->len);
@@ -232,12 +225,12 @@ test_dateChange (void)
 
 	debug_printf (1, "dateChange (date, struct of ints -> time): ");
 
-	date = soup_date_new (1970 + (rand () % 50),
-			      1 + rand () % 12,
-			      1 + rand () % 28,
-			      rand () % 24,
-			      rand () % 60,
-			      rand () % 60);
+	date = soup_date_new (1970 + (g_random_int_range (0, 50)),
+			      1 + g_random_int_range (0, 12),
+			      1 + g_random_int_range (0, 28),
+			      g_random_int_range (0, 24),
+			      g_random_int_range (0, 60),
+			      g_random_int_range (0, 60));
 	if (debug_level >= 2) {
 		timestamp = soup_date_to_string (date, SOUP_DATE_ISO8601_XMLRPC);
 		debug_printf (2, "date: %s, {", timestamp);
@@ -246,38 +239,40 @@ test_dateChange (void)
 
 	structval = soup_value_hash_new ();
 
-	if (rand () % 3) {
-		date->year = 1970 + (rand () % 50);
+#define MAYBE (g_random_int_range (0, 3) != 0)
+
+	if (MAYBE) {
+		date->year = 1970 + (g_random_int_range (0, 50));
 		debug_printf (2, "tm_year: %d, ", date->year - 1900);
 		soup_value_hash_insert (structval, "tm_year",
 					G_TYPE_INT, date->year - 1900);
 	}
-	if (rand () % 3) {
-		date->month = 1 + rand () % 12;
+	if (MAYBE) {
+		date->month = 1 + g_random_int_range (0, 12);
 		debug_printf (2, "tm_mon: %d, ", date->month - 1);
 		soup_value_hash_insert (structval, "tm_mon",
 					G_TYPE_INT, date->month - 1);
 	}
-	if (rand () % 3) {
-		date->day = 1 + rand () % 28;
+	if (MAYBE) {
+		date->day = 1 + g_random_int_range (0, 28);
 		debug_printf (2, "tm_mday: %d, ", date->day);
 		soup_value_hash_insert (structval, "tm_mday",
 					G_TYPE_INT, date->day);
 	}
-	if (rand () % 3) {
-		date->hour = rand () % 24;
+	if (MAYBE) {
+		date->hour = g_random_int_range (0, 24);
 		debug_printf (2, "tm_hour: %d, ", date->hour);
 		soup_value_hash_insert (structval, "tm_hour",
 					G_TYPE_INT, date->hour);
 	}
-	if (rand () % 3) {
-		date->minute = rand () % 60;
+	if (MAYBE) {
+		date->minute = g_random_int_range (0, 60);
 		debug_printf (2, "tm_min: %d, ", date->minute);
 		soup_value_hash_insert (structval, "tm_min",
 					G_TYPE_INT, date->minute);
 	}
-	if (rand () % 3) {
-		date->second = rand () % 60;
+	if (MAYBE) {
+		date->second = g_random_int_range (0, 60);
 		debug_printf (2, "tm_sec: %d, ", date->second);
 		soup_value_hash_insert (structval, "tm_sec",
 					G_TYPE_INT, date->second);
@@ -469,8 +464,6 @@ main (int argc, char **argv)
 		uri = default_uri;
 	}
 
-	srand (time (NULL));
-
 	session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
 
 	if (!test_sum ())



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]