http2: add range support for respondWith{File|FD}

* respondWithFD now supports optional statCheck
* respondWithFD and respondWithFile both support offset/length for
  range requests
* Fix linting nits following most recent update

PR-URL: https://github.com/nodejs/node/pull/14239
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
James M Snell 2017-07-22 09:20:53 -07:00
parent 953458f645
commit d6a774b1bd
33 changed files with 357 additions and 79 deletions

View file

@ -21,8 +21,8 @@ const URL = url.URL;
[`http://localhost:${port}`],
[new URL(`http://localhost:${port}`)],
[url.parse(`http://localhost:${port}`)],
[{port: port}, {protocol: 'http:'}],
[{port: port, hostname: '127.0.0.1'}, {protocol: 'http:'}]
[{ port: port }, { protocol: 'http:' }],
[{ port: port, hostname: '127.0.0.1' }, { protocol: 'http:' }]
];
let count = items.length;
@ -41,7 +41,7 @@ const URL = url.URL;
});
// Will fail because protocol does not match the server.
h2.connect({port: port, protocol: 'https:'})
h2.connect({ port: port, protocol: 'https:' })
.on('socketError', common.mustCall());
}));
}
@ -60,14 +60,14 @@ const URL = url.URL;
server.on('listening', common.mustCall(function() {
const port = this.address().port;
const opts = {rejectUnauthorized: false};
const opts = { rejectUnauthorized: false };
const items = [
[`https://localhost:${port}`, opts],
[new URL(`https://localhost:${port}`), opts],
[url.parse(`https://localhost:${port}`), opts],
[{port: port, protocol: 'https:'}, opts],
[{port: port, hostname: '127.0.0.1', protocol: 'https:'}, opts]
[{ port: port, protocol: 'https:' }, opts],
[{ port: port, hostname: '127.0.0.1', protocol: 'https:' }, opts]
];
let count = items.length;