Permalink
Browse files

Use 1.3 style private vars in r.m.cookies.

  • Loading branch information...
1 parent c83b552 commit 8b9fec4001b11579b74cbdc9aafc2bfc529522e2 @mmcgrana committed Oct 25, 2010
Showing with 19 additions and 17 deletions.
  1. +19 −17 ring-core/src/ring/middleware/cookies.clj
View
36 ring-core/src/ring/middleware/cookies.clj
@@ -1,32 +1,34 @@
(ns ring.middleware.cookies
"Cookie manipulation."
- (:use [clojure.contrib.def :only (defvar-)])
(:require [ring.util.codec :as codec]))
-(defvar- re-token #"[!#$%&'*\-+.0-9A-Z\^_`a-z\|~]+"
- "HTTP token: 1*<any CHAR except CTLs or tspecials>. See RFC2068")
+(def ^:private re-token
+ "HTTP token: 1*<any CHAR except CTLs or tspecials>. See RFC2068"
+ #"[!#$%&'*\-+.0-9A-Z\^_`a-z\|~]+")
-(defvar- re-quoted #"\"(\\\"|[^\"])*\""
- "HTTP quoted-string: <\"> *<any TEXT except \"> <\">. See RFC2068.")
+(def ^:private re-quoted
+ "HTTP quoted-string: <\"> *<any TEXT except \"> <\">. See RFC2068."
+ #"\"(\\\"|[^\"])*\"")
-(defvar- re-value (str re-token "|" re-quoted)
- "HTTP value: token | quoted-string. See RFC2109")
+(def ^:private re-value
+ "HTTP value: token | quoted-string. See RFC2109"
+ (str re-token "|" re-quoted))
-(defvar- re-cookie
- (re-pattern (str "\\s*(" re-token ")=(" re-value ")\\s*[;,]?"))
- "HTTP cookie-value: NAME \"=\" VALUE")
+(def ^:private re-cookie
+ "HTTP cookie-value: NAME \"=\" VALUE"
+ (re-pattern (str "\\s*(" re-token ")=(" re-value ")\\s*[;,]?")))
-(defvar- cookie-attrs
- {"$Path" :path, "$Domain" :domain, "$Port" :port}
+(def ^:private cookie-attrs
"Special attributes defined by RFC2109 and RFC2965 that apply to the
- Cookie header.")
+ Cookie header."
+ {"$Path" :path, "$Domain" :domain, "$Port" :port})
-(defvar- set-cookie-attrs
+(def ^:private set-cookie-attrs
+ "Attributes defined by RFC2109 and RFC2965 that apply to the Set-Cookie
+ header."
{:comment "Comment", :comment-url "CommentURL", :discard "Discard",
:domain "Domain", :max-age "Max-Age", :path "Path", :port "Port",
- :secure "Secure", :version "Version", :expires "Expires"}
- "Attributes defined by RFC2109 and RFC2965 that apply to the Set-Cookie
- header.")
+ :secure "Secure", :version "Version", :expires "Expires"})
(defn- parse-cookie-header
"Turn a HTTP Cookie header into a list of name/value pairs."

0 comments on commit 8b9fec4

Please sign in to comment.