From 4933927fa9c99571813210802842b13bd4c67971 Mon Sep 17 00:00:00 2001 From: Tommi Reiman Date: Wed, 22 May 2019 16:26:06 +0300 Subject: [PATCH] Add a failing test --- test/cljc/reitit/ring_test.cljc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index b23d41b7..282bbc3b 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -3,7 +3,8 @@ [clojure.set :as set] [reitit.middleware :as middleware] [reitit.ring :as ring] - [reitit.core :as r]) + [reitit.core :as r] + [reitit.trie :as trie]) #?(:clj (:import (clojure.lang ExceptionInfo)))) @@ -577,3 +578,19 @@ (fn [{:keys [::r/router]} _ _] (is router))) {} ::respond ::raise))) + +#?(:clj + (deftest invalid-path-parameters-parsing-concurrent-requests-277-test + (testing "in enought concurrent system, path-parameters can bleed" + (doseq [compiler [trie/java-trie-compiler trie/clojure-trie-compiler]] + (let [app (ring/ring-handler + (ring/router + ["/:id" (fn [request] + {:status 200 + :body (-> request :path-params :id)})]) + {::trie/trie-compiler compiler})] + (dotimes [_ 10] + (future + (dotimes [n 100000] + (let [body (:body (app {:request-method :get, :uri (str "/" n)}))] + (is (= body (str n))))))))))))