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

Function test1

test/parallel/test-http-max-http-headers.js:79–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79function test1() {
80 console.log('test1');
81 let headers =
82 'HTTP/1.1 200 OK\r\n' +
83 'Content-Length: 0\r\n' +
84 'X-CRASH: ';
85
86 // OK, Content-Length, 0, X-CRASH, aaa...
87 const currentSize = 2 + 14 + 1 + 7;
88 headers = fillHeaders(headers, currentSize);
89
90 const server = net.createServer((sock) => {
91 sock.once('data', () => {
92 writeHeaders(sock, headers);
93 sock.resume();
94 });
95
96 // The socket might error but that's ok
97 sock.on('error', () => {});
98 });
99
100 server.listen(0, common.mustCall(() => {
101 const port = server.address().port;
102 const client = http.get({ port: port }, common.mustNotCall());
103
104 client.on('error', common.mustCall((err) => {
105 assert.strictEqual(err.code, 'HPE_HEADER_OVERFLOW');
106 server.close(test2);
107 }));
108 }));
109}
110
111const test2 = common.mustCall(() => {
112 console.log('test2');

Callers 1

Calls 10

fillHeadersFunction · 0.85
writeHeadersFunction · 0.85
listenMethod · 0.80
resumeMethod · 0.65
addressMethod · 0.65
getMethod · 0.65
closeMethod · 0.65
logMethod · 0.45
onceMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected