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

@ -191,7 +191,7 @@ const {
common.expectsError({
code: 'ERR_HTTP2_HEADER_SINGLE_VALUE',
message: msg
})(mapToHeaders({[name]: [1, 2, 3]}));
})(mapToHeaders({ [name]: [1, 2, 3] }));
});
[
@ -217,7 +217,7 @@ const {
HTTP2_HEADER_VIA,
HTTP2_HEADER_WWW_AUTHENTICATE
].forEach((name) => {
assert(!(mapToHeaders({[name]: [1, 2, 3]}) instanceof Error), name);
assert(!(mapToHeaders({ [name]: [1, 2, 3] }) instanceof Error), name);
});
const regex =
@ -242,7 +242,7 @@ const regex =
common.expectsError({
code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS',
message: regex
})(mapToHeaders({[name]: 'abc'}));
})(mapToHeaders({ [name]: 'abc' }));
});
assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error));