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

Function WriteHTTPHeaders

benchmark/http/_chunky_http_client.js:22–48  ·  view source on GitHub ↗
(channel, has_keep_alive, extra_header_count)

Source from the content-addressed store, hash-verified

20 headers.push('o'.repeat(i));
21
22 function WriteHTTPHeaders(channel, has_keep_alive, extra_header_count) {
23 todo = [];
24 todo.push('GET / HTTP/1.1');
25 todo.push('Host: localhost');
26 todo.push('Connection: keep-alive');
27 todo.push('Accept: text/html,application/xhtml+xml,' +
28 'application/xml;q=0.9,image/webp,*/*;q=0.8');
29 todo.push('User-Agent: Mozilla/5.0 (X11; Linux x86_64) ' +
30 'AppleWebKit/537.36 (KHTML, like Gecko) ' +
31 'Chrome/39.0.2171.71 Safari/537.36');
32 todo.push('Accept-Encoding: gzip, deflate, sdch');
33 todo.push('Accept-Language: en-US,en;q=0.8');
34 for (let i = 0; i < extra_header_count; i++) {
35 // Utilize first three powers of a small integer for an odd cycle and
36 // because the fourth power of some integers overloads the server.
37 todo.push(`X-Header-${i}: ${headers[i % 3]}`);
38 }
39 todo.push('');
40 todo.push('');
41 todo = todo.join('\r\n');
42 // Using odd numbers in many places may increase length coverage.
43 const chunksize = 37;
44 for (let i = 0; i < todo.length; i += chunksize) {
45 const cur = todo.slice(i, i + chunksize);
46 channel.write(cur);
47 }
48 }
49
50 const min = 10;
51 let size = 0;

Callers 1

mainFunction · 0.85

Calls 4

sliceMethod · 0.65
pushMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…