Skip to content

Commit

Permalink
feat: support http2 request headers that contains multiple cookie fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrt1n authored and sunng87 committed Jun 29, 2024
1 parent 15814fd commit 9770773
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ pom.xml.asc
.idea/
*.iml
/.nrepl-port
/.clj-kondo
/.lsp
14 changes: 13 additions & 1 deletion src/ring/adapter/jetty9/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@
[^HttpField header]
[(.getLowerCaseName header) (.getValue header)])

(defn- combine-headers
([] {})
([result] result)
([result [k v]]
(if (and (= "cookie" k) (get result k))
(update result k #(str % "; " v))
(assoc result k v))))

(defn get-headers
"Creates a name/value map of all the request headers."
[^Request request]
(into {} (map header-kv*) (.getHeaders request)))
(transduce
(map header-kv*)
combine-headers
{}
(.getHeaders request)))

(defonce noop (constantly nil))

Expand Down

0 comments on commit 9770773

Please sign in to comment.