[libsoup] SoupURI: an empty query is distinct from no query
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup] SoupURI: an empty query is distinct from no query
- Date: Mon, 7 Sep 2009 22:26:04 +0000 (UTC)
commit e646a260cc08cca8e277b7ebc39e8e215f7c1ff7
Author: Dan Winship <danw gnome org>
Date: Mon Sep 7 18:25:15 2009 -0400
SoupURI: an empty query is distinct from no query
http://bugzilla.gnome.org/show_bug.cgi?id=594405
libsoup/soup-uri.c | 14 ++++++--------
tests/uri-parsing.c | 6 +++++-
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 5552f63..4f8610b 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -247,14 +247,12 @@ soup_uri_new_with_base (SoupURI *base, const char *uri_string)
/* Find query */
question = memchr (uri_string, '?', end - uri_string);
if (question) {
- if (question[1]) {
- uri->query = uri_normalized_copy (question + 1,
- end - (question + 1),
- NULL, TRUE);
- if (!uri->query) {
- soup_uri_free (uri);
- return NULL;
- }
+ uri->query = uri_normalized_copy (question + 1,
+ end - (question + 1),
+ NULL, TRUE);
+ if (!uri->query) {
+ soup_uri_free (uri);
+ return NULL;
}
end = question;
}
diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c
index 407ddfd..c2e4b58 100644
--- a/tests/uri-parsing.c
+++ b/tests/uri-parsing.c
@@ -61,7 +61,11 @@ static struct {
/* Try to recover certain kinds of invalid URIs */
{ "http://host/path with spaces",
- "http://host/path%20with%20spaces" }
+ "http://host/path%20with%20spaces" },
+
+ /* Bug 594405; 0-length is different from not-present */
+ { "http://host/path?", "http://host/path?" },
+ { "http://host/path#", "http://host/path#" }
};
static int num_abs_tests = G_N_ELEMENTS(abs_tests);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]