Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 303 redirects do GET like Net Framework #49095

Merged
merged 10 commits into from
Mar 9, 2021
Prev Previous commit
Next Next commit
Make 303 redirects do GET like Net Framework
In Net Framework, PUT redirects on a 303 do a GET.
Net 5.0 breaks compatibility with this.
See #28998
This commit causes redirects of a 303 to do a GET for all methods except HEAD.

Fix #28998
Timothy Byrd committed Mar 7, 2021
commit 98b4652aa7ee1c17a6a7c79447090c12bed8ead0
Original file line number Diff line number Diff line change
@@ -145,9 +145,7 @@ private static bool RequestRequiresForceGet(HttpStatusCode statusCode, HttpMetho
case HttpStatusCode.MultipleChoices:
return requestMethod == HttpMethod.Post;
case HttpStatusCode.SeeOther:
return requestMethod == HttpMethod.Post || requestMethod == HttpMethod.Put
|| requestMethod == HttpMethod.Delete || requestMethod == HttpMethod.Patch
|| requestMethod == HttpMethod.Options;
return requestMethod != HttpMethod.Head;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more nit: I think this should return false when requestMethod == HttpMethod.Get.

It probably doesn't make much difference, but it seems better to treat this as not changing the method, as we do with GET in other cases like Moved. If nothing else, it will avoid an unnecessary and confusing trace call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay - done.

default:
return false;
}