-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supporting https #30
supporting https #30
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
const inherits = require('util').inherits | ||
const EE = require('events').EventEmitter | ||
const net = require('net') | ||
const tls = require('tls') | ||
const retimer = require('retimer') | ||
const HTTPParser = require('http-parser-js').HTTPParser | ||
const methods = [ | ||
|
@@ -28,6 +29,7 @@ function Client (opts) { | |
|
||
this.opts = opts | ||
this.timeout = (opts.timeout || 10) * 1000 | ||
this.secure = opts.protocol === 'https:' | ||
this.parser = new HTTPParser(HTTPParser.RESPONSE) | ||
this.resData = new Array(opts.pipelining) | ||
for (var i = 0; i < this.resData.length; i++) { | ||
|
@@ -85,7 +87,12 @@ function Client (opts) { | |
inherits(Client, EE) | ||
|
||
Client.prototype._connect = function () { | ||
this.conn = net.connect(this.opts.port, this.opts.hostname) | ||
if (this.secure) { | ||
this.conn = tls.connect(this.opts.port, this.opts.hostname, { rejectUnauthorized: false }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we allow users to specify rejectUnauthorized? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. relevant, CTRL-F rejectUnauthorized: https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for a load tester it's good to not validate certificates. |
||
} else { | ||
this.conn = net.connect(this.opts.port, this.opts.hostname) | ||
} | ||
|
||
this.conn.on('error', () => { | ||
this.emit('connError') | ||
this._connect() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@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wl3YXRl | ||
cmZvcmQxDTALBgNVBAcTBHRlc3QxDTALBgNVBAoTBHRlc3QxDTALBgNVBAsTBHRl | ||
c3QxDTALBgNVBAMTBHRlc3QxGzAZBgkqhkiG9w0BCQEWDHRlc0B0ZXN0LmNvbYIJ | ||
AJn02lrTTFjxMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAJN7pnlv | ||
SascD2V0I+9wirpuuNnfUP5YCFaAjky4DREV+DRPXEL2tzTQqsEeFts8BHBH+Jz3 | ||
ytYP5NZSjuToF9czu8v3+mPCSqzdOFKruJbl/lAokLJWan8Z3qfXWZQL79C2I7Ih | ||
hSBnH/O+jZz9FPRJ2ydR8DB0LdGVKkQFvZynPZOh7D4NKvrEgFad4p6EBFshO+8N | ||
1ALfR/2mrJOkBHfHPVWMmy6DoXWyVijPuLaa+l2TzdQJycl6CAJw6F7tPoO75qKY | ||
MAcIKOW5F9Zv7I3aqmoLDOaOh43FeT2JLvODe2TIaytWckoFesGadEgvAzCAXC4r | ||
ArqQX2nVUdasOnQ= | ||
-----END CERTIFICATE----- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
Proc-Type: 4,ENCRYPTED | ||
DEK-Info: DES-EDE3-CBC,081E2A4DFAF06358 | ||
|
||
yfmHgUwn2RV+CGBYKJMBfLu+EQCKIOprjUxSBPaytTwc6NsOeVjOb/iAcVvr0D6B | ||
a6Kc8BrIMfVVjABghufAnJXav+aB6Q/LkfaqJp6AfVI86WMaCBb0Fzkg8IYYSbgy | ||
JiskTYmV1IrjYfR6TEtQmeFP0DMh1RU9VLIfehEFRMU7LcDh5Ah3bsZE5muBSlws | ||
98IVBwEwEXoQdVxLJmz+kR3fEjXYmgNZQzP6GFb3jQENV3XijQffgQ4ajREB5EZL | ||
Zag+K0vwbFZORqWNfI5VFVVWOEErRF0BSDFZWJP8jbiSX4tNyEFRzO2dgdjGycqt | ||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07cLJc | ||
WabX25aI0x58+ise5fJAQvNW6Oq2Jvt3qcUXnr2OMnR6WUQ7amgVC7JAdfRoahYU | ||
2WJl6jkCANIv5mY7ubEgVgXnuYYL4ljScpMZLER3cLW4uQnRXWo4zciz06+BadfI | ||
PjGb9xt+3EE4VB64O3yI9yBoDAM/lL0oadB8TPxFLN1NZA3gixbE6dXd5jGD9YxJ | ||
rJNu8xR4MUttiHA8+aVw84kiqsY8OzrjbJnVr2SSXARYw4dnz8DfxhPCt6hMCWnw | ||
-----END RSA PRIVATE KEY----- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably say that this is a HTTP/1.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done