Skip to content

Commit

Permalink
[Http]: Remove chunked/etc headers when redirecting a request as GET.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Baulig committed Apr 16, 2014
1 parent 28145e0 commit 828e996
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mcs/class/System/System.Net/HttpWebRequest.cs
Expand Up @@ -1109,6 +1109,13 @@ internal void DoContinueDelegate (int statusCode, WebHeaderCollection headers)
if (continueDelegate != null)
continueDelegate (statusCode, headers);
}

void RewriteRedirectToGet ()
{
method = "GET";
webHeaders.RemoveInternal ("Transfer-Encoding");
sendChunked = false;
}

bool Redirect (WebAsyncResult result, HttpStatusCode code)
{
Expand All @@ -1122,12 +1129,12 @@ bool Redirect (WebAsyncResult result, HttpStatusCode code)
case HttpStatusCode.MovedPermanently: // 301
case HttpStatusCode.Redirect: // 302
if (method == "POST")
method = "GET";
RewriteRedirectToGet ();
break;
case HttpStatusCode.TemporaryRedirect: // 307
break;
case HttpStatusCode.SeeOther: //303
method = "GET";
RewriteRedirectToGet ();
break;
case HttpStatusCode.NotModified: // 304
return false;
Expand Down

0 comments on commit 828e996

Please sign in to comment.