Commit 35e0f3c6296869c63abbd5e880eb06a36e886bc5

Philip Kelley 2013-03-25T17:59:30

Refine the redirect check condition

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/transports/http.c b/src/transports/http.c
index 851d0c0..eca06ea 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -295,9 +295,12 @@ static int on_headers_complete(http_parser *parser)
 		}
 	}
 
-	/* Check for a 302 Found (redirect).
+	/* Check for a redirect.
 	 * Right now we only permit a redirect to the same hostname. */
-	if (parser->status_code == 302 &&
+	if ((parser->status_code == 301 ||
+		 parser->status_code == 302 ||
+		 (parser->status_code == 303 && get_verb == s->verb) ||
+		 parser->status_code == 307) &&
 		t->location) {
 
 		if (s->redirect_count >= 7) {