add missing RID param validation. comment changes
This commit is contained in:
parent
616578c76b
commit
ae79343138
|
@ -708,7 +708,7 @@
|
||||||
;; maps contains whatever the messages to the server
|
;; maps contains whatever the messages to the server
|
||||||
maps (get-maps req)]
|
maps (get-maps req)]
|
||||||
;; if maps were received in this request, we should forward to listeners
|
;; if maps were received in this request, we should forward to listeners
|
||||||
;; (client is allowed to send requests in the new session request as well,
|
;; (client is allowed to send maps in the new session request as well,
|
||||||
;; so for both existing sessions and new sessions we do this)
|
;; so for both existing sessions and new sessions we do this)
|
||||||
(if (and (seq maps)
|
(if (and (seq maps)
|
||||||
session-agent)
|
session-agent)
|
||||||
|
@ -721,6 +721,9 @@
|
||||||
;; response is first array sent for this session:
|
;; response is first array sent for this session:
|
||||||
;; [[0,["c", session-id, host-prefix, version (always equal to protocol-version)]]]
|
;; [[0,["c", session-id, host-prefix, version (always equal to protocol-version)]]]
|
||||||
;; send as json for XHR and IE
|
;; send as json for XHR and IE
|
||||||
|
;; TODO: the server is allowed to flush any queued arrays and include them in the
|
||||||
|
;; response of this new-session request here (after the required first array
|
||||||
|
;; with the session-id, etc in it).
|
||||||
(let [session @session-agent
|
(let [session @session-agent
|
||||||
session-id (:id session)
|
session-id (:id session)
|
||||||
;; @todo extract the used host-prefix from the request if any
|
;; @todo extract the used host-prefix from the request if any
|
||||||
|
@ -741,17 +744,21 @@
|
||||||
;; GET req server->client is a backwardchannel opened by client
|
;; GET req server->client is a backwardchannel opened by client
|
||||||
(defn- handle-backward-channel
|
(defn- handle-backward-channel
|
||||||
[req session-agent options]
|
[req session-agent options]
|
||||||
(let [type (get-in req [:query-params "TYPE"])]
|
(let [type (get-in req [:query-params "TYPE"])
|
||||||
|
rid (get-in req [:query-params "RID"])]
|
||||||
(cond
|
(cond
|
||||||
(#{"xmlhttp" "html"} type)
|
(#{"xmlhttp" "html"} type)
|
||||||
;; @todo check that query RID is "rpc"
|
(if-not (= "rpc" rid)
|
||||||
{:async :http
|
(error-response 400 "Invalid RID")
|
||||||
:reactor (fn [respond]
|
{:async :http
|
||||||
(write-head respond)
|
:reactor (fn [respond]
|
||||||
(send-off session-agent set-back-channel respond req))}
|
(write-head respond)
|
||||||
|
(send-off session-agent set-back-channel respond req))})
|
||||||
|
|
||||||
(= type "terminate")
|
(= type "terminate")
|
||||||
;; this is a request made in an img tag
|
(do
|
||||||
(do ;;end session
|
;; this is a request made in an img tag
|
||||||
|
;;end session
|
||||||
(when session-agent
|
(when session-agent
|
||||||
(send-off session-agent close req "Client disconnected"))
|
(send-off session-agent close req "Client disconnected"))
|
||||||
{:status 200
|
{:status 200
|
||||||
|
|
Reference in a new issue