Skip to content

Commit

Permalink
Fix reverse proxy sending content if there must be none
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaliumhexacyanoferrat committed Jan 20, 2020
1 parent bc9bf7d commit ed665ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Modules/GenHTTP.Modules.Core/Proxy/ReverseProxyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override IResponseBuilder HandleInternal(IRequest request)
{
var req = ConfigureRequest(request);

if (request.Content != null)
if ((request.Content != null) && CanSendBody(request))
{
using (var inputStream = req.GetRequestStream())
{
Expand Down Expand Up @@ -191,6 +191,11 @@ private bool HasBody(IRequest request, HttpWebResponse response)
return !request.HasType(RequestMethod.HEAD) && (response.ContentType != null);
}

private bool CanSendBody(IRequest request)
{
return (request.Method != RequestMethod.GET) && (request.Method != RequestMethod.HEAD);
}

private string RewriteLocation(string location, IRequest request)
{
if (location.StartsWith(Upstream))
Expand Down

0 comments on commit ed665ce

Please sign in to comment.