Skip to content

Commit

Permalink
Fixed HTTP Proxy starting line #29. Added Property HttpRequest.Proxy.…
Browse files Browse the repository at this point in the history
…AbsoluteUriInStartingLine for changing that behaviour.
  • Loading branch information
grandsilence committed Feb 19, 2019
1 parent 7f7c715 commit e6f788d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Leaf.xNet/~Http/HttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,11 +2016,11 @@ private void CreateConnection(Uri address)
private string GenerateStartingLine(HttpMethod method)
{
// Fix by Igor Vacil'ev: sometimes proxies returns 404 when used full path.
/*string query = _currentProxy != null && _currentProxy.Type == ProxyType.HTTP
string query = _currentProxy != null && _currentProxy.Type == ProxyType.HTTP && _currentProxy.AbsoluteUriInStartingLine
? Address.AbsoluteUri
: Address.PathAndQuery;*/
: Address.PathAndQuery;

return $"{method} {Address.PathAndQuery} HTTP/{ProtocolVersion}\r\n";
return $"{method} {query} HTTP/{ProtocolVersion}\r\n";
}


Expand Down
7 changes: 7 additions & 0 deletions Leaf.xNet/~Proxy/ProxyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ public virtual int ReadWriteTimeout
}
}

/// <summary>
/// Возвращает или задает значение, следует ли задавать полный адрес ресурса в заголовке запроса специально для прокси.
/// Если задано <see langword="true"/> (по умолчанию) - если прокси задан верно, использовать абсолютный адрес в заголовке запроса.
/// Если задано <see langword="false"/> - всегда будет использован относительный адрес в заголовке запроса.
/// </summary>
public bool AbsoluteUriInStartingLine { get; set; } = true;

#endregion


Expand Down

0 comments on commit e6f788d

Please sign in to comment.