Skip to content

Commit

Permalink
Limit http header size
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreepeong committed Jul 17, 2024
1 parent cdde1fb commit 3aa4b1f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,11 @@ public HttpInstallTaskConfig(IndexedZiPatchInstaller installer, int sourceIndex,
}

using HttpRequestMessage req = new(HttpMethod.Get, SourceUrl);
req.Headers.Range = new()
{
Unit = "bytes"
};
foreach (var (rangeFrom, rangeToExclusive) in offsets)
req.Headers.Range = new() { Unit = "bytes" };
foreach (var (rangeFrom, rangeToExclusive) in offsets.Take(400))
req.Headers.Range.Ranges.Add(new(rangeFrom, rangeToExclusive + 1));
// "1000000000-1000000000,": 22 bytes; 22x400=8800 bytes in HTTP header should be fine?

if (this.sid != null)
req.Headers.Add("X-Patch-Unique-Id", this.sid);
req.Headers.Add("User-Agent", Constants.PatcherUserAgent);
Expand Down

0 comments on commit 3aa4b1f

Please sign in to comment.