Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: allow ca, key and cert will be string (regression) #1676

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

alexander-akait
Copy link
Member

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

Yes

Motivation / Use-Case

fixes #1674

Breaking Changes

No

Additional Info

It is regression, just not pfx can't be string due it is binary format

@@ -610,7 +623,7 @@ class Server {
const pems = createCertificate(attrs);

fs.writeFileSync(certPath, pems.private + pems.cert, {
encoding: 'utf-8',
encoding: 'utf8',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov
Copy link

codecov bot commented Feb 21, 2019

Codecov Report

Merging #1676 into master will increase coverage by 1.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1676      +/-   ##
==========================================
+ Coverage   75.12%   76.17%   +1.04%     
==========================================
  Files          17       17              
  Lines         591      596       +5     
  Branches      172      173       +1     
==========================================
+ Hits          444      454      +10     
+ Misses        113      108       -5     
  Partials       34       34
Impacted Files Coverage Δ
lib/Server.js 79.89% <100%> (+1.34%) ⬆️
lib/utils/createCertificate.js 100% <0%> (+33.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df113eb...d17b5f6. Read the comment docs.


if (stats) {
// It is file
options.https[property] = fs.readFileSync(path.resolve(value));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this have utf8 encoding as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alan-agius4 hm, maybe, can you provide example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need
https://github.com/nodejs/node/blob/master/lib/fs.js#L392

buffer.toString :

encoding <string> The character encoding to use. Default: 'utf8'.

buf.toString([encoding[, start[, end]]])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So default is utf8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for clarifying

@alexander-akait
Copy link
Member Author

/cc @hiroppy need review

Copy link
Member

@hiroppy hiroppy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thx!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing an SSL key or certificate as a raw string results in an exception
3 participants