Skip to content

Commit

Permalink
[#271] Client: pass through unexpected protocols for chsk url
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Sep 26, 2016
1 parent fb83622 commit 7925ddc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/taoensso/sente.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1372,11 +1372,15 @@

#?(:cljs
(defn- get-chsk-url [protocol host path type]
(let [protocol (case protocol :http "http:" :https "https:" protocol)
protocol (have [:el #{"http:" "https:"}] protocol)
protocol (case type
:ajax protocol
:ws (case protocol "https:" "wss:" "http:" "ws:"))]
(let [;; Some users require other protocols here (e.g. "file:"), so we
;; explicitly allow pass-through:
protocol (case protocol :http "http:" :https "https:" protocol)
protocol
(case (str/lower-case (str protocol))
"http:" (if (= type :ws) "ws:" protocol)
"https:" (if (= type :ws) "wss:" protocol)
protocol)]

(str protocol "//" (enc/path host path)))))

#?(:cljs
Expand Down

0 comments on commit 7925ddc

Please sign in to comment.