libsoup r1101 - in trunk: . libsoup tests



Author: danw
Date: Thu Feb 28 17:14:45 2008
New Revision: 1101
URL: http://svn.gnome.org/viewvc/libsoup?rev=1101&view=rev

Log:
	(redirect_handler): PROPFIND is defined to be "safe and
	idempotent", so allow automatic redirects of it. (Pointed out by
	Christian Kellner. FIXME: need a way for apps to declare
	additional safe methods). Also, treat 302 like 307, not like 303,
	because that behavior is universal in the real world, despite the
	spec's protests.

	* tests/redirect-test.c (tests): update POST 302 behavior check

	* tests/Makefile.am (TESTS): oops, add redirect-test so it gets
	run by "make check"/"make distcheck"


Modified:
   trunk/ChangeLog
   trunk/libsoup/soup-session.c
   trunk/tests/Makefile.am
   trunk/tests/redirect-test.c

Modified: trunk/libsoup/soup-session.c
==============================================================================
--- trunk/libsoup/soup-session.c	(original)
+++ trunk/libsoup/soup-session.c	Thu Feb 28 17:14:45 2008
@@ -647,14 +647,15 @@
 	g_return_if_fail (new_loc != NULL);
 
 	if (msg->status_code == SOUP_STATUS_MOVED_PERMANENTLY ||
-	    msg->status_code == SOUP_STATUS_FOUND ||
 	    msg->status_code == SOUP_STATUS_TEMPORARY_REDIRECT) {
 		/* Don't redirect non-safe methods */
 		if (msg->method != SOUP_METHOD_GET &&
 		    msg->method != SOUP_METHOD_HEAD &&
-		    msg->method != SOUP_METHOD_OPTIONS)
+		    msg->method != SOUP_METHOD_OPTIONS &&
+		    msg->method != SOUP_METHOD_PROPFIND)
 			return;
-	} else if (msg->status_code == SOUP_STATUS_SEE_OTHER) {
+	} else if (msg->status_code == SOUP_STATUS_SEE_OTHER ||
+		   msg->status_code == SOUP_STATUS_FOUND) {
 		/* Redirect using a GET */
 		g_object_set (msg,
 			      SOUP_MESSAGE_METHOD, SOUP_METHOD_GET,

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Thu Feb 28 17:14:45 2008
@@ -67,8 +67,9 @@
 	continue-test	\
 	date		\
 	header-parsing	\
-	uri-parsing	\
 	ntlm-test	\
+	redirect-test	\
+	uri-parsing	\
 	$(APACHE_TESTS)	\
 	$(CURL_TESTS)	\
 	$(SSL_TESTS)	\

Modified: trunk/tests/redirect-test.c
==============================================================================
--- trunk/tests/redirect-test.c	(original)
+++ trunk/tests/redirect-test.c	Thu Feb 28 17:14:45 2008
@@ -59,11 +59,12 @@
 	    { "GET", "/302", 302 },
 	    { "GET", "/", 200 } } },
 
-	/* POST should only automatically redirect on 303 */
+	/* POST should only automatically redirect on 302 and 303 */
 
 	{ { { "POST", "/301", 301 },
 	    { NULL } } },
 	{ { { "POST", "/302", 302 },
+	    { "GET", "/", 200 },
 	    { NULL } } },
 	{ { { "POST", "/303", 303 },
 	    { "GET", "/", 200 },



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