Skip to content
This repository was archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from djanowski/fix-https-protocol
Browse files Browse the repository at this point in the history
Fix SSL requests when not providing an explicit `protocol` option.
  • Loading branch information
assaf committed Apr 28, 2015
2 parents 6233469 + 7f9a617 commit 5c3a398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/replay/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ URL = require("url")
httpRequest = HTTP.request
httpsRequest = HTTPS.request

copy = (obj) ->
o = {}

for key of obj
o[key] = obj[key]

return o

# Route HTTP requests to our little helper.
HTTP.request = (options, callback)->
Expand Down Expand Up @@ -49,6 +56,8 @@ HTTPS.request = (options, callback)->
return httpsRequest(options, callback)

# Proxy request
options = copy(options)
options.protocol = "https:"
request = new ProxyRequest(options, Replay.chain.start)
if callback
request.once("response", callback)
Expand Down
1 change: 0 additions & 1 deletion test/pass_through_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe "Pass through", ->
before (done)->
options =
method: "GET"
protocol: "https:"
hostname: "pass-through"
port: HTTPS_PORT
agent: false
Expand Down

0 comments on commit 5c3a398

Please sign in to comment.