Skip to content
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

Fix issues with elasticsearch and ssl #4734

Merged
merged 4 commits into from
Aug 26, 2015
Merged

Conversation

lukasolson
Copy link
Member

Closes #4697.

There were several issues when we ported the agent creation from the old server architecture to the new one.

  1. The new create agent code never utilized https.Agent, but instead used http.Agent even if https was specified in the config.
  2. The new code was also caching agentOptions, which seems harmless, but for some unknown reason, if you use the same options object when calling new https.Agent(options), the agent you get on calls after the first has problems with POST requests (but not PUT... bizarre, I know). I've changed the function to use _.memoize instead of manually caching agentOptions, and doing so caches the entire Agent object instead of just the agentOptions.
  3. The new code was specifying crt as an option instead of cert (as the API instructs).

@lukasolson lukasolson changed the title Attempt to fix issues with elasticsearch and ssl Fix issues with elasticsearch and ssl Aug 24, 2015
@tbragin
Copy link
Contributor

tbragin commented Aug 24, 2015

Checked out the latest, and... it works for me!

@w33ble
Copy link
Contributor

w33ble commented Aug 26, 2015

Works for me as well, and the changes all make sense. LGTM, passing on for final code review.

@w33ble w33ble assigned simianhacker and unassigned w33ble Aug 26, 2015
module.exports = function (server) {
var https = require('https');

module.exports = _.memoize(function (server) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Memoize doesn't work with objects, does it? Pretty sure it stringifies these. You'll probably need to set module.exports.cache to be a new Map() or something for this to work right.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or just cache them in a Map yourself

Copy link
Member Author

Choose a reason for hiding this comment

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

You're totally right. I'll fix this. Good catch.

@spalger
Copy link
Contributor

spalger commented Aug 26, 2015

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants