File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/org/bovinegenius/exploding_fish Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 3030
3131(defn generic
3232 " Takes a URI string and parses it into scheme, scheme-relative,
33- and fragment parts."
33+ and fragment parts."
3434 [^String uri]
3535 (if uri
3636 (let [[_ scheme ssp fragment] (or (re-find #"^([a-zA-Z][a-zA-Z\d +.-]*):([^#]+)#?(.*)$" uri)
@@ -60,7 +60,7 @@ parts."
6060 " Parse the authority part into user-info, hostname, and port parts."
6161 [authority]
6262 (if authority
63- (let [[_ user-info host port] (re-find #"^([^@]+(?=@))?@?([^:]+):?(. *)$" authority)
63+ (let [[_ user-info host port] (re-find #"^([^@]+(?=@))?@?([^:]+| \[ [0-9a-fA-F:]* \] ):?(\d *)$" authority)
6464 port (if (empty? port) nil (Integer/parseInt port))]
6565 {:user-info user-info :host host :port port})
6666 {:user-info nil :host nil :port nil }))
Original file line number Diff line number Diff line change 3030 :authority " www.fred.net" ,
3131 :scheme " http" ,
3232 :scheme-relative " //www.fred.net/" })))
33+ (let [uri-string " http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html" ]
34+ (is (= (into {} (uri uri-string))
35+ {:scheme " http"
36+ :scheme-relative " //[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html"
37+ :authority " [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80"
38+ :host " [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]"
39+ :port 80
40+ :path " /index.html" })))
3341 (let [uri-string " http://www.domain.net/with?query=and#fragment" ]
3442 (is (= (into {} (uri uri-string))
3543 (into {} (uri (URI. uri-string)))
You can’t perform that action at this time.
0 commit comments