Skip to content

Commit

Permalink
Make it possible to connect to an outcome service with a self-signed …
Browse files Browse the repository at this point in the history
…certificate.

agent is removed from options otherwise request will ignore ca (see https://nodejs.org/api/https.html#https_https_request_options_callback)
  • Loading branch information
ktonon authored and omsmith committed Jun 20, 2015
1 parent ad0db90 commit a6032e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/extensions/outcomes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class OutcomeService
@source_did = options.source_did
@result_data_types = options.result_data_types or []
@signer = options.signer or (new HMAC_SHA1())
@cert_authority = options.cert_authority or null
@language = options.language or 'en'

# Break apart the service url into the url fragments for use by OAuth signing, additionally prepare the OAuth
Expand Down Expand Up @@ -157,11 +158,15 @@ class OutcomeService

options =
hostname: @service_url_parts.hostname
agent: if is_ssl then https.globalAgent else http.globalAgent
path: @service_url_parts.path
method: 'POST'
headers: @_build_headers xml

if @cert_authority and is_ssl
options.ca = @cert_authority
else
options.agent = if is_ssl then https.globalAgent else http.globalAgent

if @service_url_parts.port
options.port = @service_url_parts.port

Expand Down

0 comments on commit a6032e3

Please sign in to comment.