Pass go headers through in updater/differential
This commit is contained in:
parent
637b67d9a5
commit
da7a76e03f
2 changed files with 9 additions and 1 deletions
|
@ -76,6 +76,12 @@ describe('updater/differential', () => {
|
||||||
|
|
||||||
beforeEach(callback => {
|
beforeEach(callback => {
|
||||||
server = http.createServer(async (req, res) => {
|
server = http.createServer(async (req, res) => {
|
||||||
|
if (!req.headers['user-agent']?.includes('Signal-Desktop')) {
|
||||||
|
res.writeHead(403);
|
||||||
|
res.end(`Invalid user agent: "${req.headers['user-agent']}"`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const file = req.url?.slice(1) ?? '';
|
const file = req.url?.slice(1) ?? '';
|
||||||
if (!allowedFiles.has(file)) {
|
if (!allowedFiles.has(file)) {
|
||||||
res.writeHead(404);
|
res.writeHead(404);
|
||||||
|
|
|
@ -350,9 +350,11 @@ export async function downloadRanges(
|
||||||
diffByRange.set(`${readOffset}-${readOffset + size - 1}`, diff);
|
diffByRange.set(`${readOffset}-${readOffset + size - 1}`, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gotOptions = getGotOptions();
|
||||||
const stream = got.stream(`${url}`, {
|
const stream = got.stream(`${url}`, {
|
||||||
...getGotOptions(),
|
...gotOptions,
|
||||||
headers: {
|
headers: {
|
||||||
|
...gotOptions.headers,
|
||||||
range: `bytes=${Array.from(diffByRange.keys()).join(',')}`,
|
range: `bytes=${Array.from(diffByRange.keys()).join(',')}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue