Skip to content

Commit

Permalink
Upgrade to Undertow 1.3.0.Beta9 to get HTTP/2 support [IMMUTANT-570]
Browse files Browse the repository at this point in the history
A change in the way sessions are handled inside Undertow required
changes to one test, see:
http://lists.jboss.org/pipermail/undertow-dev/2015-August/001335.html
  • Loading branch information
tobias committed Aug 28, 2015
1 parent f5840f4 commit 4eece3b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -92,7 +92,7 @@
environ "1.0.0"

;; org.projectodd.wunderboss "0.8.1"
org.projectodd.wunderboss "1.x.incremental.281"
org.projectodd.wunderboss "1.x.incremental.282"
;; org.projectodd.wunderboss "0.8.2-SNAPSHOT"

org.immutant :version
Expand Down
29 changes: 18 additions & 11 deletions web/test/immutant/web/async_test.clj
Expand Up @@ -134,23 +134,30 @@
(stop)))

(deftest http-session-invalidation
(let [http (atom {})
(let [session-obj (atom {})
handler (fn [req]
(let [result (if-not (-> req :session :foo)
(-> (response "yay")
(assoc :session {:foo "yay"}))
(-> (response "boo")
(assoc :session nil)))]
(reset! http (-> req :server-exchange Sessions/getOrCreateSession))
result))]
(run (wrap-session handler))
(is (= "yay" (get-body url :cookies nil)))
(is (= "yay" (-> @http (.getAttribute "ring-session-data") :foo)))
(is (= "boo" (get-body url)))
(is (thrown? IllegalStateException (-> @http (.getAttribute "ring-session-data") :foo)))
(is (= "yay" (get-body url)))
(is (= "yay" (-> @http (.getAttribute "ring-session-data") :foo)))
(stop)))
result))
orig-get-or-create-session (deref #'immutant.web.internal.undertow/get-or-create-session)]
(with-redefs [immutant.web.internal.undertow/get-or-create-session
(fn g-o-c-s
([exchange] (g-o-c-s exchange nil))
([exchange opts]
(let [session (orig-get-or-create-session exchange opts)]
(reset! session-obj session)
session)))]
(run (wrap-session handler))
(is (= "yay" (get-body url :cookies nil)))
(is (= "yay" (-> @session-obj (.getAttribute "ring-session-data") :foo)))
(is (= "boo" (get-body url)))
(is (thrown? IllegalStateException (-> @session-obj (.getAttribute "ring-session-data") :foo)))
(is (= "yay" (get-body url)))
(is (= "yay" (-> @session-obj (.getAttribute "ring-session-data") :foo)))
(stop))))

(defmethod initialize-stream :test
[& _])
Expand Down

0 comments on commit 4eece3b

Please sign in to comment.