Unverified Commit 0bd4ec92 authored by honfika's avatar honfika Committed by GitHub

Merge pull request #699 from justcoding121/master

No body for head request (#695)
parents b3bbac37 9c2bc8bb
...@@ -166,6 +166,8 @@ namespace Titanium.Web.Proxy.Http ...@@ -166,6 +166,8 @@ namespace Titanium.Web.Proxy.Http
return; return;
} }
Response.RequestMethod = Request.Method;
var httpStatus = await Connection.Stream.ReadResponseStatus(cancellationToken); var httpStatus = await Connection.Stream.ReadResponseStatus(cancellationToken);
Response.HttpVersion = httpStatus.Version; Response.HttpVersion = httpStatus.Version;
Response.StatusCode = httpStatus.StatusCode; Response.StatusCode = httpStatus.StatusCode;
......
...@@ -36,6 +36,8 @@ namespace Titanium.Web.Proxy.Http ...@@ -36,6 +36,8 @@ namespace Titanium.Web.Proxy.Http
/// </summary> /// </summary>
public string StatusDescription { get; set; } = string.Empty; public string StatusDescription { get; set; } = string.Empty;
internal string RequestMethod { get; set; }
/// <summary> /// <summary>
/// Has response body? /// Has response body?
/// </summary> /// </summary>
...@@ -43,6 +45,11 @@ namespace Titanium.Web.Proxy.Http ...@@ -43,6 +45,11 @@ namespace Titanium.Web.Proxy.Http
{ {
get get
{ {
if (RequestMethod == "HEAD")
{
return false;
}
long contentLength = ContentLength; long contentLength = ContentLength;
// If content length is set to 0 the response has no body // If content length is set to 0 the response has no body
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment