How to use the Agent function from http

Find comprehensive JavaScript http.Agent code examples handpicked from public code repositorys.

50
51
52
53
54
55
56
57
58
59
maxContentLength: (((1024 * 1024) * 1024) * 1024),
maxBodyLength: (((1024 * 1024) * 1024) * 1024),
httpsAgent: new https.Agent({
    keepAlive: true
}),
httpAgent: new http.Agent({
    keepAlive: true
}),
proxy: false,
headers: {
fork icon24
star icon118
watch icon8

87
88
89
90
91
92
93
94
95
96
  return tls.connect(options);
}


function Agent(options) {
  http.Agent.call(this, options);
  this.createConnection = createConnection;
}
inherits(Agent, http.Agent);
Agent.prototype.defaultPort = 443;
fork icon14
star icon113
watch icon10

1
2
3
4
5
6
7
8
9
10
var os = require('os');
var http = require('http');
var crypto = require('crypto');
var qs = require('querystring');
var LRU = require('lru-cache');
var httpAgent = http.Agent;
var httpsAgent = require('https').Agent;
var url = require('url');
var fse = require('fs-extra2');
var Buffer = require('safe-buffer').Buffer;
fork icon0
star icon1
watch icon1

+ 5 other calls in file

340
341
342
343
344
345
346
347
348
349
+  }, common.platformTimeout(500));
+}, 2));
+
+server.keepAliveTimeout = common.platformTimeout(200);
+
+const agent = new http.Agent({
+  keepAlive: true,
+  maxSockets: 1
+});
+
fork icon11
star icon0
watch icon1

3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
http.IncomingMessage = response.IncomingMessage


http.Agent = function () {}
http.Agent.defaultMaxSockets = 4


http.globalAgent = new http.Agent()


http.STATUS_CODES = statusCodes


http.METHODS = [
fork icon0
star icon0
watch icon1

+ 4 other calls in file

59
60
61
62
63
64
65
66
67
68
  this.request = this.request.bind(this);
  this.request.agent = agent;
}

sshlnk(target) {
  const agent = new http.Agent();

  let lnk;

  let locker = keepAliveMgr(function() {
fork icon0
star icon0
watch icon2

49
50
51
52
53
54
55
56
57
58
59
60
    serverApi: ServerApiVersion.v1,
});


const server = http.createServer(app)


var agent = new http.Agent({
    keepAlive: true,
    maxSockets: 1,
    keepAliveMsecs: 3000
})
fork icon0
star icon0
watch icon1

70
71
72
73
74
75
76
77
78
79
}
inherits(Agent, http.Agent);
Agent.prototype.createConnection = createConnection;

Agent.prototype.getName = function(options) {
  var name = http.Agent.prototype.getName.call(this, options);

  name += ':';
  if (options.ca)
    name += options.ca;
fork icon0
star icon0
watch icon4

+ 3 other calls in file