From 2b2804244616d13203ea2d9d7f8ec6efbf0a0b94 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Sat, 21 Dec 2019 15:12:07 +0100 Subject: [PATCH] Fix a mistake in the redirect fetch code The spec says to ignore both HEAD and GET in step 11 --- components/net/http_loader.rs | 4 +++- .../metadata/fetch/api/redirect/redirect-method.any.js.ini | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index 10c2d7faaec7..74262db3f1c9 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -804,7 +804,9 @@ pub fn http_redirect_fetch( .map_or(false, |(code, _)| { ((*code == StatusCode::MOVED_PERMANENTLY || *code == StatusCode::FOUND) && request.method == Method::POST) || - (*code == StatusCode::SEE_OTHER && request.method != Method::HEAD) + (*code == StatusCode::SEE_OTHER && + request.method != Method::HEAD && + request.method != Method::GET) }) { // Step 11.1 diff --git a/tests/wpt/metadata/fetch/api/redirect/redirect-method.any.js.ini b/tests/wpt/metadata/fetch/api/redirect/redirect-method.any.js.ini index e2d28b961344..8f719427a8d0 100644 --- a/tests/wpt/metadata/fetch/api/redirect/redirect-method.any.js.ini +++ b/tests/wpt/metadata/fetch/api/redirect/redirect-method.any.js.ini @@ -1,7 +1,4 @@ [redirect-method.any.worker.html] - [Redirect 303 with GET] - expected: FAIL - [Redirect 307 with POST (string body)] expected: FAIL @@ -10,9 +7,6 @@ [redirect-method.any.html] - [Redirect 303 with GET] - expected: FAIL - [Redirect 307 with POST (string body)] expected: FAIL