Skip to content

Commit

Permalink
New property AcceptEncoding. Some servers using custom AcceptEncoding…
Browse files Browse the repository at this point in the history
… format: like "gzip,deflate" (without space). Chromium and Firefox using space version.
  • Loading branch information
grandsilence committed Nov 3, 2018
1 parent aba5b00 commit 489c1fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Leaf.xNet/~Http/HttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ public event EventHandler<DownloadProgressChangedEventArgs> DownloadProgressChan
/// </summary>
public bool EnableMiddleHeaders { get; set; }

/// <summary>
/// Заголовок AcceptEncoding. Стоит обратить внимание что не все сайты принимают версию с пробелом: "gzip, deflate".
/// </summary>
public string AcceptEncoding { get; set; } = "gzip,deflate";

#region Поведение

/// <summary>
Expand Down Expand Up @@ -2076,7 +2081,7 @@ private Dictionary<string, string> GenerateCommonHeaders(HttpMethod method, long
#region Content

if (EnableEncodingContent)
headers["Accept-Encoding"] = "gzip, deflate";
headers["Accept-Encoding"] = AcceptEncoding;

if (Culture != null)
headers["Accept-Language"] = GetLanguageHeader();
Expand Down

0 comments on commit 489c1fb

Please sign in to comment.