maddox / magic-cards

🎩 Queue music, play movies, or trigger events with RFID cards.
MIT License
564 stars 49 forks source link

Disabling SSL verification when SSL is not required leads to HTTPS request #87

Open EagleAdam opened 3 years ago

EagleAdam commented 3 years ago

I initially had this in my actions file that I had written by hand:

{
  "Home Assistant": {
    "type": "home_assistant",
    "host": "172.16.0.51",
    "port": "8123",
    "ssl": false,
    "verify_ssl": false,
    "token": "......"
  }
}

As a result, I got an error:

[1] Found card: 43535. Processing...
[1] Processing action: Home Assistant
[1] Error [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
[1]     at new ClientRequest (_http_client.js:132:11)
[1]     at request (http.js:41:10)
[1]     at /usr/src/app/scanner/node_modules/node-fetch/lib/index.js:1375:15
[1]     at new Promise (<anonymous>)
[1]     at fetch (/usr/src/app/scanner/node_modules/node-fetch/lib/index.js:1367:9)
[1]     at HomeAssistantAction.request (/usr/src/app/scanner/actions/HomeAssistantAction.js:50:12)
[1]     at HomeAssistantAction.process (/usr/src/app/scanner/actions/HomeAssistantAction.js:7:10)
[1]     at CardProcessor.processCard (/usr/src/app/scanner/CardProcessor.js:55:23)
[1]     at CardProcessor.process (/usr/src/app/scanner/CardProcessor.js:19:10)
[1]     at Keyboard.<anonymous> (/usr/src/app/scanner/scanner.js:17:19)

I now understand that in #https://github.com/maddox/magic-cards/commit/6406abffa5e81c1dc6d8db3eef159f1f9afa3aca as a result of allowing the option to disable SSL verification, if that option is set to false (even if ssl is set to false) then it tries to make an HTTPS request.

If SSL is set to false, then presumably verify_ssl should be ignored?