Skip to content

Commit

Permalink
Merge pull request #1584 from Soreepeong/fix/http-req-size
Browse files Browse the repository at this point in the history
Limit http header size on repairs
  • Loading branch information
goaaats committed Jul 17, 2024
2 parents 8c8e8f0 + 3aa4b1f commit 19c603d
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 19c603d

Please sign in to comment.