weavejester / compojure

A concise routing library for Ring/Clojure
Eclipse Public License 1.0
4.08k stars 259 forks source link

Support for CONNECT method #170

Closed jeaye closed 7 years ago

jeaye commented 7 years ago

Looks like there's no support for CONNECT, as described here: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods

Even when using ANY, CONNECT isn't parsed properly. I don't think compojure would need to do anything specific with it, just know how to parse it and send it along as a valid route. This would be useful for anyone looking to write an HTTP tunnel using ring + compojure. :)

Example:

CONNECT jeaye.com:443 HTTP/1.1
Host: jeaye.com:443
User-Agent: curl/7.54.0
Proxy-Connection: Keep-Alive
weavejester commented 7 years ago

I don't think CONNECT is used often enough to have a routing macro by default. However, Compojure allows you to easily create your own:

(defmacro CONNECT [path args & body]
  (compile-route :connect path args body))
jeaye commented 7 years ago

Okie dokie. Thanks for considering it! I'll define my own for now.