Clean up includes
authorDan Winship <danw@gnome.org>
Fri, 6 Jul 2012 17:09:50 +0000 (13:09 -0400)
committerDan Winship <danw@gnome.org>
Fri, 13 Jul 2012 18:18:36 +0000 (14:18 -0400)
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).

96 files changed:
libsoup/soup-address.c
libsoup/soup-auth-basic.c
libsoup/soup-auth-digest.c
libsoup/soup-auth-domain-basic.c
libsoup/soup-auth-domain-digest.c
libsoup/soup-auth-domain.c
libsoup/soup-auth-manager-ntlm.c
libsoup/soup-auth-manager.c
libsoup/soup-auth-ntlm.c
libsoup/soup-auth.c
libsoup/soup-body-input-stream.c
libsoup/soup-body-output-stream.c
libsoup/soup-cache.c
libsoup/soup-client-input-stream.c
libsoup/soup-connection.c
libsoup/soup-content-decoder.c
libsoup/soup-content-sniffer-stream.c
libsoup/soup-content-sniffer.c
libsoup/soup-converter-wrapper.c
libsoup/soup-cookie-jar-sqlite.c
libsoup/soup-cookie-jar-text.c
libsoup/soup-cookie-jar.c
libsoup/soup-cookie.c
libsoup/soup-date.c
libsoup/soup-directory-input-stream.c
libsoup/soup-filter-input-stream.c
libsoup/soup-form.c
libsoup/soup-headers.c
libsoup/soup-io-stream.c
libsoup/soup-logger.c
libsoup/soup-message-body.c
libsoup/soup-message-client-io.c
libsoup/soup-message-headers.c
libsoup/soup-message-io.c
libsoup/soup-message-queue.c
libsoup/soup-message-server-io.c
libsoup/soup-message.c
libsoup/soup-misc.c
libsoup/soup-multipart.c
libsoup/soup-password-manager-gnome.c
libsoup/soup-password-manager.c
libsoup/soup-path-map.c
libsoup/soup-proxy-resolver-default.c
libsoup/soup-proxy-resolver-gnome.c
libsoup/soup-proxy-resolver-static.c
libsoup/soup-proxy-resolver.c
libsoup/soup-proxy-uri-resolver.c
libsoup/soup-request-data.c
libsoup/soup-request-file.c
libsoup/soup-request-http.c
libsoup/soup-request.c
libsoup/soup-requester.c
libsoup/soup-server.c
libsoup/soup-session-async.c
libsoup/soup-session-feature.c
libsoup/soup-session-sync.c
libsoup/soup-session.c
libsoup/soup-socket.c
libsoup/soup-status.c
libsoup/soup-tld.c
libsoup/soup-tld.h
libsoup/soup-uri.c
libsoup/soup-value-utils.c
libsoup/soup-xmlrpc.c
tests/auth-test.c
tests/chunk-test.c
tests/coding-test.c
tests/connection-test.c
tests/context-test.c
tests/continue-test.c
tests/cookies-test.c
tests/date.c
tests/dns.c
tests/forms-test.c
tests/get.c
tests/header-parsing.c
tests/misc-test.c
tests/ntlm-test.c
tests/proxy-test.c
tests/pull-api.c
tests/range-test.c
tests/redirect-test.c
tests/requester-test.c
tests/server-auth-test.c
tests/simple-httpd.c
tests/simple-proxy.c
tests/sniffing-test.c
tests/ssl-test.c
tests/streaming-test.c
tests/test-utils.c
tests/test-utils.h
tests/timeout-test.c
tests/tld-test.c
tests/uri-parsing.c
tests/xmlrpc-server-test.c
tests/xmlrpc-test.c

index 38974c6..f2e698b 100644 (file)
@@ -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
index 7df7e1e..fb491c7 100644 (file)
 #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;
index 712967f..5fe7561 100644 (file)
@@ -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));
index 0575caa..9e8afe8 100644 (file)
@@ -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
index 86e2285..985919f 100644 (file)
 #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
index 6b7a629..2ac37e3 100644 (file)
@@ -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
index ae59504..f2b67d1 100644 (file)
 #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;
index 64637e9..b3ef9f6 100644 (file)
 #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;
index 7bba70f..391c1c2 100644 (file)
 #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;
index 73f0c79..6960e52 100644 (file)
@@ -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"
index e554f21..a38955f 100644 (file)
 #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,
index 5c93347..86f131a 100644 (file)
@@ -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)
index fc44053..95182f8 100644 (file)
 #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);
index 29ac87e..a22c685 100644 (file)
@@ -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 {
index a70e764..c9d8884 100644 (file)
@@ -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;
index aeda5f0..0651338 100644 (file)
@@ -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
index 14a21a3..42e9247 100644 (file)
 #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);
 
index 4cf3864..b5fd125 100644 (file)
 #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
index 3ca45ad..45d34a3 100644 (file)
@@ -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
index a0b6b79..97e6a0e 100644 (file)
 #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
index 64f03dc..433c571 100644 (file)
@@ -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
index 2d47aab..433e704 100644 (file)
@@ -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
index 7d6b583..c553c52 100755 (executable)
 #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
index cf338e5..9973078 100644 (file)
@@ -12,9 +12,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <glib.h>
 
 #include "soup-date.h"
+#include "soup.h"
 
 /**
  * SoupDate:
index 3fe946b..eb8228a 100644 (file)
 #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"
index ba0137f..79159c3 100644 (file)
@@ -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
index 3fe6578..5946dae 100644 (file)
@@ -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
index 5b85c71..ffa1e77 100644 (file)
@@ -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:
index 3ade3db..74c7158 100644 (file)
@@ -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 {
index e68c4a8..3183cce 100644 (file)
 #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
index 6cff98d..0868d84 100644 (file)
@@ -8,6 +8,7 @@
 #include <string.h>
 
 #include "soup-message-body.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-message-body
index f6c752f..1310bb8 100644 (file)
@@ -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,
index eb50034..6e396d1 100644 (file)
@@ -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);
 }
index 7a554df..42ddb7d 100644 (file)
@@ -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"
 #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 {
index 9715080..8ef129a 100644 (file)
@@ -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
index c40ace8..a53e5b7 100644 (file)
@@ -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,
index eae697d..8a45395 100644 (file)
@@ -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
index 5c09526..8354045 100644 (file)
@@ -5,7 +5,6 @@
  * Copyright (C) 2000-2003, Ximian, Inc.
  */
 
-#include <ctype.h>
 #include <string.h>
 
 #include "soup-misc.h"
index a88281f..aa0b04b 100644 (file)
@@ -8,7 +8,7 @@
 #include <string.h>
 
 #include "soup-multipart.h"
-#include "soup-headers.h"
+#include "soup.h"
 
 /**
  * SECTION:soup-multipart
index bf36cb0..475cb59 100644 (file)
@@ -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);
 
index fed0156..3914179 100644 (file)
@@ -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);
index 60191b4..ca280df 100644 (file)
@@ -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
index 8e33e8b..76e9ff6 100644 (file)
@@ -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:
index e01dd6a..bc42337 100644 (file)
@@ -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)
 
index 93a833a..9432767 100644 (file)
@@ -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;
index ca60411..8092175 100644 (file)
 #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);
index 01f4f4f..8aecec4 100644 (file)
@@ -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)
 
index 8a2e065..933d752 100644 (file)
 #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)
 
index 3c5ddc0..0b5638d 100644 (file)
 #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)
 
index 9e7c945..319a591 100644 (file)
 #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)
 
index df855ae..e7471c1 100644 (file)
@@ -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
index c3d1f32..281ebb1 100644 (file)
 #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);
index 9ec1301..5dcafa1 100644 (file)
@@ -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
index 4073838..c9eda19 100644 (file)
 
 #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
index 3728149..9f9b235 100644 (file)
@@ -10,6 +10,7 @@
 #endif
 
 #include "soup-session-feature.h"
+#include "soup.h"
 #include "soup-message-private.h"
 
 /**
index d8e2110..3ac290a 100644 (file)
 
 #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
index a674f29..23f9e94 100644 (file)
@@ -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 */
 
index 8899b48..2ac359d 100644 (file)
@@ -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
index 2590a3d..7b048a8 100644 (file)
@@ -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
index 5a8dad2..4dce00b 100644 (file)
@@ -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);
index 5610d62..2d1eebd 100644 (file)
@@ -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,
index c2fc434..f4422ce 100644 (file)
@@ -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
index d9f6bdc..b929544 100644 (file)
@@ -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
index 49eced6..f790858 100644 (file)
 #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
index 3bbee87..85c4d41 100644 (file)
@@ -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);
                }
 
index c3eecc4..cce7127 100644 (file)
@@ -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 {
index ea8b857..47f5d08 100644 (file)
@@ -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;
index 7c6fb5a..ee2a78b 100644 (file)
@@ -3,10 +3,6 @@
  * Copyright 2007-2012 Red Hat, Inc.
  */
 
-#include <string.h>
-
-#include <libsoup/soup.h>
-
 #include "test-utils.h"
 
 SoupServer *server;
index 673ae21..97cd2c0 100644 (file)
@@ -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;
index dafe182..fa9ef80 100644 (file)
@@ -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"
index 87f4673..58f8052 100644 (file)
@@ -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;
index 5b3ec34..54a59f2 100644 (file)
@@ -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);
index 1751cfb..f594064 100644 (file)
@@ -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);
                }
 
index fbbd97c..1d254b1 100644 (file)
@@ -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);
        }
 
index d3b6eac..1d86715 100644 (file)
@@ -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);
index fcdd550..e57d7d8 100644 (file)
@@ -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"
 
index a2b9937..9d75a9c 100644 (file)
@@ -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;
index f5462c6..00222e8 100644 (file)
@@ -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 {
index 62bbd99..cebc839 100644 (file)
@@ -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);
        }
 
index febe490..512d176 100644 (file)
@@ -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);
        }
 
index d7ba922..98f5645 100644 (file)
@@ -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);
        }
 
index cf294c4..45166e6 100644 (file)
@@ -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);
        }
 
index 4da46ab..b4e86ea 100644 (file)
@@ -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);
        }
 
index 89e5943..757e065 100644 (file)
@@ -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);
        }
 
index ab88bf9..46f0988 100644 (file)
@@ -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);
index 52c2412..f25f9a0 100644 (file)
@@ -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);
index 2812334..dd4eb4a 100644 (file)
@@ -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;
index f999d82..6d96bc7 100644 (file)
@@ -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"
 
index 869a7b6..239e0ce 100644 (file)
@@ -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);
        }
index fee671a..f2a3bd6 100644 (file)
@@ -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);
        }
 
index 98c12fd..78f7e48 100644 (file)
@@ -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);
index 4cde526..2bb91d8 100644 (file)
@@ -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"
 
index 7be0ae7..5952444 100644 (file)
@@ -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 */
index fb04144..124dfe9 100644 (file)
@@ -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);
index ebb7ca6..8ad2187 100644 (file)
@@ -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);
index f442e2c..ec67e4d 100644 (file)
@@ -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 ())