Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agentOptions追加 & デフォルトのsecureOptionsを削除
- Loading branch information
Showing
11 changed files
with
231 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<meta http-equiv="refresh" content="0;URL=http://localhost:5555/~info"> | ||
<meta http-equiv="refresh" content="0;URL=http://localhost:55551/~info"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/*eslint-env mocha*/ | ||
/*eslint no-invalid-this:0*/ | ||
/*jshint -W100*/ | ||
var assert = require('power-assert'); | ||
var typeOf = require('type-of'); | ||
var constants = require('constants'); | ||
var helper = require('./_helper'); | ||
var cli = require('../index'); | ||
|
||
// オレオレ証明書のサーバーにアクセスできるようにする | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; | ||
|
||
describe('https', function () { | ||
it('agentOptions未設定 => TLS1.2 Onlyのサーバーに接続可能', function (done) { | ||
cli.fetch(helper.url('%https%'), function (err, $, res, body) { | ||
assert(! err); | ||
assert(typeOf(res) === 'object'); | ||
assert(typeOf($) === 'function'); | ||
assert(typeOf(body) === 'string'); | ||
assert(body === 'hello, https'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('agentOptions: TLS1.2強制 => TLS1.2 Onlyのサーバーに接続可能', function (done) { | ||
cli.set('agentOptions', { | ||
secureProtocol: 'TLSv1_2_method' | ||
}); | ||
cli.fetch(helper.url('%https%'), function (err, $, res, body) { | ||
assert(! err); | ||
assert(typeOf(res) === 'object'); | ||
assert(typeOf($) === 'function'); | ||
assert(typeOf(body) === 'string'); | ||
assert(body === 'hello, https'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('agentOptions: TLS1.2強制 => httpのサーバーにも接続可能', function (done) { | ||
cli.set('agentOptions', { | ||
secureProtocol: 'TLSv1_2_method' | ||
}); | ||
cli.fetch(helper.url('~info'), function (err, $, res, body) { | ||
assert(! err); | ||
assert(typeOf(res) === 'object'); | ||
assert(typeOf($) === 'function'); | ||
assert(typeOf(body) === 'string'); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('agentOptions: TLS1.1強制 => TLS1.2 Onlyのサーバーに接続不可', function (done) { | ||
cli.set('agentOptions', { | ||
secureProtocol: 'TLSv1_1_method' | ||
}); | ||
var url = helper.url('%https%'); | ||
cli.fetch(url, function (err, $, res, body) { | ||
assert(err.errno === 'EPROTO'); | ||
assert(err.code === 'EPROTO'); | ||
assert(err.message.indexOf('handshake failure:') !== -1); | ||
assert(err.url === url); | ||
assert(! res); | ||
assert(! $); | ||
assert(! body); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('agentOptions: TLS1.2無効 => TLS1.2 Onlyのサーバーに接続不可', function (done) { | ||
cli.set('agentOptions', { | ||
secureOptions: constants.SSL_OP_NO_TLSv1_2 | ||
}); | ||
var url = helper.url('%https%'); | ||
cli.fetch(url, function (err, $, res, body) { | ||
assert(err.errno === 'EPROTO'); | ||
assert(err.code === 'EPROTO'); | ||
assert(err.message.indexOf('handshake failure:') !== -1); | ||
assert(err.url === url); | ||
assert(! res); | ||
assert(! $); | ||
assert(! body); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDTDCCAjQCCQCIfNWNVBmJrTANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJK | ||
UDEOMAwGA1UECAwFVG9reW8xFjAUBgNVBAcMDU11c2FzaGluby1zaGkxDDAKBgNV | ||
BAoMA0ZvbzEMMAoGA1UECwwDQmFyMRQwEgYDVQQDDAtmb28uYmFyLmNvbTAgFw0x | ||
NzExMTAwMDUyNTlaGA8yMjE3MDkyMzAwNTI1OVowZzELMAkGA1UEBhMCSlAxDjAM | ||
BgNVBAgMBVRva3lvMRYwFAYDVQQHDA1NdXNhc2hpbm8tc2hpMQwwCgYDVQQKDANG | ||
b28xDDAKBgNVBAsMA0JhcjEUMBIGA1UEAwwLZm9vLmJhci5jb20wggEiMA0GCSqG | ||
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDs2GLh7pYfzD2rfvokOGud4uRJY7FuhprY | ||
3FL6ICRQBZVtuEZMqDIVUFz89m/VW0GFNz290Pj0UP2WHcXGUr5pfRtNbMLCer1g | ||
DdHDsevSVRZzbgP68EW6q3te5pti7wcso1U2dhFfGZTZNE0PoFdeJYV7bPoByAWH | ||
I/EPWfSOAMb8VcjZbVfVfn69OC1rc07EtVRBa2H9B2ovs03EVc0iuXkNFGzQSsXA | ||
3R98xUaKvimQYPtMnn5mXbN0xrJCIpVMj/HPhDlMX3ZFcSy8W1ICmeH4RT670RnD | ||
j/3H1qdgogKFq+n4eh7Fi3jIZ8Sh3mbQVekIsDLMS8bgeKI9TXeVAgMBAAEwDQYJ | ||
KoZIhvcNAQELBQADggEBAGermRUgss3JjhSL+KizeYhqvJP0+GnmsCHAzItScCUH | ||
ONRjoASb+XkJJbNKreaSn/O7H76sambkUPH6HYpulGnwQvNjhipcs4sEtsMduoUF | ||
zuOwEJDGOuDhi6mbxif8sNuN6Gh0xXPzNxzyGzS5C3sKjxT7G7Wm04FzSUC2dOhS | ||
89xU4r4T9v4otVpieZfHyi81Jua6eSBDaMw0IMXH3SpMdsorbR66c+hsG1eBDyyg | ||
w1i+v0GlB3NAPmomjdtkysjwNpW9l7NbvV3MhR/HRmMPmUp4TSWvAIF6BTgzMHjE | ||
Ichze9UqovoCPO881JWV+nBFQ1EQw0WS4QUSB5nm8JU= | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpQIBAAKCAQEA7Nhi4e6WH8w9q376JDhrneLkSWOxboaa2NxS+iAkUAWVbbhG | ||
TKgyFVBc/PZv1VtBhTc9vdD49FD9lh3FxlK+aX0bTWzCwnq9YA3Rw7Hr0lUWc24D | ||
+vBFuqt7XuabYu8HLKNVNnYRXxmU2TRND6BXXiWFe2z6AcgFhyPxD1n0jgDG/FXI | ||
2W1X1X5+vTgta3NOxLVUQWth/QdqL7NNxFXNIrl5DRRs0ErFwN0ffMVGir4pkGD7 | ||
TJ5+Zl2zdMayQiKVTI/xz4Q5TF92RXEsvFtSApnh+EU+u9EZw4/9x9anYKIChavp | ||
+HoexYt4yGfEod5m0FXpCLAyzEvG4HiiPU13lQIDAQABAoIBAQDIBA2t48FgZSmH | ||
lRp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Blj50idCxi//0WSExJT | ||
eAdLH9ECgYEAxh/IanVVsIHed8tU4CoBbHIbyvrjjMlAlhexsrQ0gazJKvdGWGXC | ||
WQnCGNMZ9cnXoYP07upEpkc5hG+P+mqpU2Lpm5zbmteDGKP0e+HG9kBHToKmXVNi | ||
VgyNFITaOpTWERIwVSnQDjFLbIzL8VgQtUUP/bD4QJ7uKE0//TkirBM= | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters