Skip to content

Commit

Permalink
Respect NODE_TLS_REJECT_UNAUTHORIZED environment variable under node (#…
Browse files Browse the repository at this point in the history
…2670)

* fix: Respect NODE_TLS_REJECT_UNAUTHORIZED environment when setting up the node Http Client sslAgent

* chore: change log for bugfix-s3-8f3bc1d4.json

* chore: change log component bugfix-node-s3-sqs-8f3bc1d4

* Add unit test for PR

* Fix typo

* Test should do no harm

* style: linting errors fixed in node_http_client.spec

* style: space-before-function-paren fix in node_http_client.spec

Co-authored-by: kimihiro64 <[email protected]>
  • Loading branch information
bbeausej and kimihiro64 authored Jan 31, 2020
1 parent fb9e50e commit 3dd8ab4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-node-s3-sqs-8f3bc1d4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "node-s3-sqs",
"description": "Respect the NODE_TLS_REJECT_UNAUTHORIZED environment under node when instantiating an http client sslAgent"
}
2 changes: 1 addition & 1 deletion lib/http/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ AWS.NodeHttpClient = AWS.util.inherit({
if (useSSL) {
if (!AWS.NodeHttpClient.sslAgent) {
AWS.NodeHttpClient.sslAgent = new http.Agent(AWS.util.merge({
rejectUnauthorized: true
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0' ? false : true
}, agentOptions || {}));
AWS.NodeHttpClient.sslAgent.setMaxListeners(0);

Expand Down
44 changes: 42 additions & 2 deletions test/node_http_client.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3dd8ab4

Please sign in to comment.