[libsoup] SOUP_URI_VALID_FOR_HTTP: update to check uri->path too



commit 4af6f29c5e3e84fdaaa19798e72686db91069458
Author: Dan Winship <danw gnome org>
Date:   Sat Nov 21 09:32:21 2009 -0500

    SOUP_URI_VALID_FOR_HTTP: update to check uri->path too

 libsoup/soup-uri.c |    4 ++--
 libsoup/soup-uri.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 4f8610b..8cb49fd 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -350,12 +350,12 @@ soup_uri_new_with_base (SoupURI *base, const char *uri_string)
 	/* HTTP-specific stuff */
 	if (uri->scheme == SOUP_URI_SCHEME_HTTP ||
 	    uri->scheme == SOUP_URI_SCHEME_HTTPS) {
+		if (!uri->path)
+			uri->path = g_strdup ("/");
 		if (!SOUP_URI_VALID_FOR_HTTP (uri)) {
 			soup_uri_free (uri);
 			return NULL;
 		}
-		if (!uri->path)
-			uri->path = g_strdup ("/");
 	}
 
 	if (!uri->port)
diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h
index b540e40..21e465d 100644
--- a/libsoup/soup-uri.h
+++ b/libsoup/soup-uri.h
@@ -84,7 +84,7 @@ guint     soup_uri_host_hash             (gconstpointer key);
 gboolean  soup_uri_host_equal            (gconstpointer v1,
 					  gconstpointer v2);
 
-#define   SOUP_URI_VALID_FOR_HTTP(uri) ((uri) && ((uri)->scheme == SOUP_URI_SCHEME_HTTP || (uri)->scheme == SOUP_URI_SCHEME_HTTPS) && (uri)->host)
+#define   SOUP_URI_VALID_FOR_HTTP(uri) ((uri) && ((uri)->scheme == SOUP_URI_SCHEME_HTTP || (uri)->scheme == SOUP_URI_SCHEME_HTTPS) && (uri)->host && (uri)->path)
 
 G_END_DECLS
 



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