MCPcopy Index your code
hub / github.com/nodejs/node / processRespondWithFD

Function processRespondWithFD

lib/internal/http2/core.js:2709–2745  ·  view source on GitHub ↗
(self, fd, headers, offset = 0, length = -1,
                              streamOptions = 0)

Source from the content-addressed store, hash-verified

2707}
2708
2709function processRespondWithFD(self, fd, headers, offset = 0, length = -1,
2710 streamOptions = 0) {
2711 const state = self[kState];
2712 state.flags |= STREAM_FLAGS_HEADERS_SENT;
2713
2714 let headersList;
2715 try {
2716 headersList = buildNgHeaderString(
2717 headers,
2718 assertValidPseudoHeaderResponse,
2719 self.session[kStrictSingleValueFields],
2720 );
2721 } catch (err) {
2722 if (self.ownsFd)
2723 tryClose(fd);
2724 self.destroy(err);
2725 return;
2726 }
2727 self[kSentHeaders] = headers;
2728
2729 // Close the writable side of the stream, but only as far as the writable
2730 // stream implementation is concerned.
2731 self._final = null;
2732 self.end();
2733
2734 const ret = self[kHandle].respond(headersList, streamOptions);
2735
2736 if (ret < 0) {
2737 if (self.ownsFd)
2738 tryClose(fd);
2739 self.destroy(new NghttpError(ret));
2740 return;
2741 }
2742
2743 defaultTriggerAsyncIdScope(self[async_id_symbol], startFilePipe,
2744 self, fd, offset, length);
2745}
2746
2747function startFilePipe(self, fd, offset, length) {
2748 const handle = new FileHandle(fd, offset, length);

Callers 3

doSendFDFunction · 0.85
doSendFileFDFunction · 0.85
respondWithFDMethod · 0.85

Calls 6

buildNgHeaderStringFunction · 0.85
tryCloseFunction · 0.85
destroyMethod · 0.45
endMethod · 0.45
respondMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…