remove hardcoded browserchannel protocol version number
This commit is contained in:
parent
5056d14d3a
commit
472a551606
|
@ -19,6 +19,8 @@
|
|||
|
||||
|
||||
|
||||
(def protocol-version 8)
|
||||
|
||||
(def ^:private noop-string "[\"noop\"]")
|
||||
|
||||
;; almost all special cases are for making this work with IE
|
||||
|
@ -670,8 +672,8 @@
|
|||
;; and if the connection can support streaming
|
||||
(defn- handle-test-channel
|
||||
[req options]
|
||||
(if-not (= "8" (get-in req [:query-params "VER"]))
|
||||
(error-response 400 "Version 8 required")
|
||||
(if-not (= (str protocol-version) (get-in req [:query-params "VER"]))
|
||||
(error-response 400 (str "Version " protocol-version " required"))
|
||||
;; phase 1
|
||||
;; client requests [random host-prefix or
|
||||
;; nil,blockedPrefix]
|
||||
|
@ -709,7 +711,7 @@
|
|||
;; first post after a new session is a message with the session
|
||||
;; details.
|
||||
;; response is first array sent for this session:
|
||||
;; [[0,["c", session-id, host-prefix, version (always 8)]]]
|
||||
;; [[0,["c", session-id, host-prefix, version (always equal to protocol-version)]]]
|
||||
;; send as json for XHR and IE
|
||||
(let [session @session-agent
|
||||
session-id (:id session)
|
||||
|
@ -717,7 +719,7 @@
|
|||
host-prefix nil]
|
||||
{:status 200
|
||||
:headers (assoc (:headers options) "Content-Type" "application/javascript")
|
||||
:body (size-json-str (json/generate-string [[0, ["c", session-id, host-prefix, 8]]]))})
|
||||
:body (size-json-str (json/generate-string [[0, ["c", session-id, host-prefix, protocol-version]]]))})
|
||||
;; For existing sessions:
|
||||
;; Forward sent data by client to listeners
|
||||
;; reply with
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
resp (app (-> (mock/request
|
||||
:post "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" 1
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"zx" (random-string)
|
||||
"t" 1}))
|
||||
options)]
|
||||
|
@ -55,7 +55,7 @@
|
|||
(is (and (string? session-id)
|
||||
(not (string/blank? session-id))))
|
||||
(is (nil? host-prefix))
|
||||
(is (= 8 version))
|
||||
(is (= protocol-version version))
|
||||
(is (get @sessions session-id))
|
||||
(is (connected? session-id)))))
|
||||
|
||||
|
@ -63,9 +63,9 @@
|
|||
(let [resp (app (-> (mock/request
|
||||
:get "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" "rpc"
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"CI" 0
|
||||
"AID" 0
|
||||
"TYPE" "xmlhttp"
|
||||
|
@ -78,10 +78,10 @@
|
|||
(let [resp (app (-> (mock/request
|
||||
:get "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" "rpc"
|
||||
"SID" "foobar"
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"CI" 0
|
||||
"AID" 0
|
||||
"TYPE" "xmlhttp"
|
||||
|
@ -95,9 +95,9 @@
|
|||
(-> (mock/request
|
||||
:post "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" 1
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"zx" (random-string)
|
||||
"t" 1})))
|
||||
|
||||
|
@ -118,10 +118,10 @@
|
|||
back-resp (app (-> (mock/request
|
||||
:get "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" "rpc"
|
||||
"SID" session-id
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"CI" 0
|
||||
"AID" 0
|
||||
"TYPE" "xmlhttp"
|
||||
|
@ -142,10 +142,10 @@
|
|||
(-> (mock/request
|
||||
:get "/channel/bind")
|
||||
(mock/query-string
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"RID" "rpc"
|
||||
"SID" session-id
|
||||
"CVER" 8
|
||||
"CVER" protocol-version
|
||||
"CI" 0
|
||||
"AID" 0
|
||||
"TYPE" "xmlhttp"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
(deftest get-host-prefixes-test-no-prefixes
|
||||
(let [resp (app (mock/request
|
||||
:get "/channel/test"
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"MODE" "init"
|
||||
"zx" (random-string)
|
||||
"t" 1}))]
|
||||
|
@ -55,7 +55,7 @@
|
|||
{:host-prefixes ["a", "b", "c"]})
|
||||
resp (app (mock/request
|
||||
:get "/channel/test"
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"MODE" "init"
|
||||
"zx" (random-string)
|
||||
"t" 1})
|
||||
|
@ -69,7 +69,7 @@
|
|||
(deftest buffering-proxy-test
|
||||
(let [resp (app (mock/request
|
||||
:get "/channel/test"
|
||||
{"VER" 8
|
||||
{"VER" protocol-version
|
||||
"zx" (random-string)
|
||||
"t" 1}))
|
||||
async-resp @async-output]
|
||||
|
|
Reference in a new issue