diff options
| author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-01-10 13:51:31 +0000 |
|---|---|---|
| committer | Dan Winship <danw@gnome.org> | 2012-02-06 17:12:26 -0500 |
| commit | 301ccb120ff20d15b98be942748143be3909d979 (patch) | |
| tree | cf166e09883a1770c4a3c41518acb3ffa7010073 /libsoup/soup-uri.c | |
| parent | 675979d4aa6a72d8415294f989aeb20a6eae2ab6 (diff) | |
| download | libsoup-301ccb120ff20d15b98be942748143be3909d979.tar.gz | |
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
Diffstat (limited to 'libsoup/soup-uri.c')
| -rw-r--r-- | 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 0e4c31c6..d2d752a0 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; } |
