[libsoup] soup_uri_new: do not allow invalid URIs to be returned, except via soup_uri_new (NULL)



commit 301ccb120ff20d15b98be942748143be3909d979
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Jan 10 13:51:31 2012 +0000

    soup_uri_new: do not allow invalid URIs to be returned, except via soup_uri_new (NULL)
    
    Also document the possible NULL return.
    
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=667637
    Bug-NB: NB#294977

 libsoup/soup-uri.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 0e4c31c..d2d752a 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -405,7 +405,8 @@ soup_uri_new_with_base (SoupURI *base, const char *uri_string)
  * call at least soup_uri_set_scheme() and soup_uri_set_path(), since
  * those fields are required.)
  *
- * Return value: a #SoupURI, or %NULL.
+ * Return value: a #SoupURI, or %NULL if the given string was found to be
+ *  invalid.
  **/
 SoupURI *
 soup_uri_new (const char *uri_string)
@@ -418,7 +419,7 @@ soup_uri_new (const char *uri_string)
 	uri = soup_uri_new_with_base (NULL, uri_string);
 	if (!uri)
 		return NULL;
-	if (!uri->scheme) {
+	if (!SOUP_URI_IS_VALID (uri)) {
 		soup_uri_free (uri);
 		return NULL;
 	}



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