+2008-12-09 Dan Winship <danw@gnome.org>
+
+ * libsoup/soup-uri.c (soup_uri_new): Explicitly document the fact
+ that you have to call soup_uri_set_path() when using
+ soup_uri_new(NULL), since path is required to be non-%NULL.
+
+ * libsoup/soup-connection.c (connect_message): initialize
+ uri->path
+
+ * libsoup/soup-cookie.c (soup_cookie_applies_to_uri):
+ g_return_val_if_fail() rather than crashing if uri->path is %NULL.
+ Also, fix the cookie/uri path comparison to not potentially read
+ off the end of uri->path. #562191, Mark Lee.
+
2008-12-04 Dan Winship <danw@gnome.org>
* libsoup/soup-form.c (soup_form_decode): Correctly handle forms
soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS);
soup_uri_set_host (uri, soup_address_get_name (priv->server_addr));
soup_uri_set_port (uri, soup_address_get_port (priv->server_addr));
+ soup_uri_set_path (uri, "");
msg = soup_message_new_from_uri (SOUP_METHOD_CONNECT, uri);
soup_uri_free (uri);
if (cookie->expires && soup_date_is_past (cookie->expires))
return FALSE;
+ /* uri->path is required to be non-NULL */
+ g_return_val_if_fail (uri->path != NULL, FALSE);
+
/* The spec claims "/foo would match /foobar", but fortunately
* no one is really that crazy.
*/
plen = strlen (cookie->path);
if (cookie->path[plen - 1] == '/')
plen--;
+ if (strncmp (cookie->path, uri->path, plen) != 0)
+ return FALSE;
if (uri->path[plen] && uri->path[plen] != '/')
return FALSE;
- return !strncmp (cookie->path, uri->path, plen);
+ return TRUE;
}
gboolean
* Parses an absolute URI.
*
* You can also pass %NULL for @uri_string if you want to get back an
- * "empty" #SoupURI that you can fill in by hand.
+ * "empty" #SoupURI that you can fill in by hand. (You will need to
+ * call at least soup_uri_set_scheme() and soup_uri_set_path(), since
+ * those fields are required.)
*
* Return value: a #SoupURI, or %NULL.
**/