Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
58478d8
http2: add http fallback options to .createServer
hekike Oct 27, 2017
5ea29ef
http: add options to http.createServer()
Oct 19, 2017
ae2ebde
http2: add req and res options to server creation
Oct 5, 2017
28a2729
http2: use `_final` instead of `on('finish')`
addaleax Feb 7, 2018
8b234f5
doc: warn against concurrent http2stream.respondWithFD
addaleax Feb 13, 2018
c6a9abd
src: add nullptr check for session in DEBUG macro
danbev Feb 16, 2018
d85e5f4
doc: fix typo in http2.md
vsemozhetbyt Feb 19, 2018
55cf145
deps,src: align ssize_t ABI between Node & nghttp2
addaleax Feb 4, 2018
b1d95ec
http2: fix condition where data is lost
mcollina Feb 19, 2018
1029369
http2: send error text in case of ALPN mismatch
addaleax Feb 25, 2018
0379350
http2: use original error for cancelling pending streams
addaleax Feb 25, 2018
1f3ab4f
http2: fix endless loop when writing empty string
addaleax Feb 22, 2018
199d9a5
test: check endless loop while writing empty string
XadillaX Feb 11, 2018
10aaa74
http2: fix flaky test-http2-https-fallback
mcollina Mar 2, 2018
f165e9f
http2: no stream destroy while its data is on the wire
addaleax Feb 26, 2018
8daddfb
doc: add note about browsers and HTTP/2
styfle Mar 20, 2018
0137eb7
http2: remove some unnecessary next ticks
jasnell Mar 19, 2018
8f55971
doc: rename HTTP2 to HTTP/2
TimothyGu Mar 26, 2018
9c7bf7f
test: http2 stream.respond() error checks
trivikr Feb 19, 2018
519b063
http2: destroy() stream, upon errnoException
Mar 16, 2018
22eddf1
doc: guard against md list parsing edge case
vsemozhetbyt Mar 28, 2018
f5a2cd5
test: http2 errors on req.close()
trivikr Feb 18, 2018
af7c7cb
http2: callback valid check before closing request
trivikr Feb 28, 2018
3a890a8
doc, http2: add sections for server.close()
chrismilleruk Apr 4, 2018
4dc0b3c
doc: add Http2Session.connecting property
pietermees Apr 6, 2018
c83098a
http2: emit session connect on next tick
pietermees Apr 9, 2018
1f35b8f
src: expose uv.errmap to binding
joyeecheung Dec 25, 2017
d501138
util: implement util.getSystemErrorName()
joyeecheung Jan 16, 2018
a3754e7
errors: lazy load util in internal/errors.js
joyeecheung Jan 24, 2018
2179547
util: skip type checks in internal getSystemErrorName
joyeecheung Feb 3, 2018
d8b637f
errors: move error creation helpers to errors.js
joyeecheung Feb 3, 2018
74e3b14
errors: make message non-enumerable
BridgeAR Apr 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: warn against concurrent http2stream.respondWithFD
Upcoming changes to move away from synchronous I/O on the main
thread will imply that using the same file descriptor to
respond on multiple HTTP/2 streams at the same time is invalid,
because at least on Windows `uv_fs_read()` is race-y.

Therefore, warn against such usage.

Backport-PR-URL: #20456
PR-URL: #18762
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
addaleax authored and MylesBorins committed May 2, 2018
commit 8b234f5a28c8b87087aed1049043c5405c1ed57e
19 changes: 13 additions & 6 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -1262,19 +1262,19 @@ automatically.
const http2 = require('http2');
const fs = require('fs');

const fd = fs.openSync('/some/file', 'r');

const server = http2.createServer();
server.on('stream', (stream) => {
const fd = fs.openSync('/some/file', 'r');

const stat = fs.fstatSync(fd);
const headers = {
'content-length': stat.size,
'last-modified': stat.mtime.toUTCString(),
'content-type': 'text/plain'
};
stream.respondWithFD(fd, headers);
stream.on('close', () => fs.closeSync(fd));
});
server.on('close', () => fs.closeSync(fd));
```

The optional `options.statCheck` function may be specified to give user code
Expand All @@ -1287,6 +1287,12 @@ The `offset` and `length` options may be used to limit the response to a
specific range subset. This can be used, for instance, to support HTTP Range
requests.

The file descriptor is not closed when the stream is closed, so it will need
to be closed manually once it is no longer needed.
Note that using the same file descriptor concurrently for multiple streams
is not supported and may result in data loss. Re-using a file descriptor
after a stream has finished is supported.

When set, the `options.getTrailers()` function is called immediately after
queuing the last chunk of payload data to be sent. The callback is passed a
single object (with a `null` prototype) that the listener may use to specify
Expand All @@ -1296,10 +1302,10 @@ the trailing header fields to send to the peer.
const http2 = require('http2');
const fs = require('fs');

const fd = fs.openSync('/some/file', 'r');

const server = http2.createServer();
server.on('stream', (stream) => {
const fd = fs.openSync('/some/file', 'r');

const stat = fs.fstatSync(fd);
const headers = {
'content-length': stat.size,
Expand All @@ -1311,8 +1317,9 @@ server.on('stream', (stream) => {
trailers['ABC'] = 'some value to send';
}
});

stream.on('close', () => fs.closeSync(fd));
});
server.on('close', () => fs.closeSync(fd));
```

*Note*: The HTTP/1 specification forbids trailers from containing HTTP/2
Expand Down