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

@ -27,7 +27,7 @@ function onStream(stream, headers) {
}
function verifySecureSession(key, cert, ca, opts) {
const server = h2.createSecureServer({cert, key});
const server = h2.createSecureServer({ cert, key });
server.on('stream', common.mustCall(onStream));
server.listen(0);
server.on('listening', common.mustCall(function() {
@ -35,7 +35,7 @@ function verifySecureSession(key, cert, ca, opts) {
if (!opts) {
opts = {};
}
opts.secureContext = tls.createSecureContext({ca});
opts.secureContext = tls.createSecureContext({ ca });
const client = h2.connect(`https://localhost:${this.address().port}`, opts, function() {
const req = client.request(headers);
@ -72,4 +72,4 @@ verifySecureSession(
loadKey('agent1-key.pem'),
loadKey('agent1-cert.pem'),
loadKey('ca1-cert.pem'),
{servername: 'agent1'});
{ servername: 'agent1' });