libsoup r1256 - in trunk: . libsoup



Author: danw
Date: Fri Mar 27 16:19:47 2009
New Revision: 1256
URL: http://svn.gnome.org/viewvc/libsoup?rev=1256&view=rev

Log:
	* libsoup/soup-cookie.c (soup_cookie_new): Fix docs to not claim
	that the cookie domain can be %NULL. Add some g_return_if_fail()s.


Modified:
   trunk/ChangeLog
   trunk/libsoup/soup-cookie.c

Modified: trunk/libsoup/soup-cookie.c
==============================================================================
--- trunk/libsoup/soup-cookie.c	(original)
+++ trunk/libsoup/soup-cookie.c	Fri Mar 27 16:19:47 2009
@@ -43,7 +43,8 @@
  * SoupCookie:
  * @name: the cookie name
  * @value: the cookie value
- * @domain: the "domain" attribute, or %NULL
+ * @domain: the "domain" attribute, or else the hostname that the
+ * cookie came from.
  * @path: the "path" attribute, or %NULL
  * @expires: the cookie expiration time, or %NULL for a session cookie
  * @secure: %TRUE if the cookie should only be tranferred over SSL
@@ -401,7 +402,7 @@
  * soup_cookie_new:
  * @name: cookie name
  * @value: cookie value
- * @domain: cookie domain, or %NULL
+ * @domain: cookie domain or hostname
  * @path: cookie path, or %NULL
  * @max_age: max age of the cookie, or -1 for a session cookie
  *
@@ -430,6 +431,18 @@
 {
 	SoupCookie *cookie;	
 
+	g_return_val_if_fail (name != NULL, NULL);
+	g_return_val_if_fail (value != NULL, NULL);
+
+	/* We ought to return if domain is NULL too, but this used to
+	 * do be incorrectly documented as legal, and it wouldn't
+	 * break anything as long as you called
+	 * soup_cookie_set_domain() immediately after. So we warn but
+	 * don't return, to discourage that behavior but not actually
+	 * break anyone doing it.
+	 */
+	g_warn_if_fail (domain != NULL);
+
 	cookie = g_slice_new0 (SoupCookie);
 	cookie->name = g_strdup (name);
 	cookie->value = g_strdup (value);



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