File tree 2 files changed +26
-5
lines changed
2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,9 @@ make-port*: func [
84
84
digits: [1 5 digit]
85
85
alpha-num: make bitset! [#"a" - #"z" #"A" - #"Z" #"0" - #"9" ]
86
86
scheme-char: insert copy alpha-num "+-."
87
- path-char: insert copy alpha-num "/=+-_.;:&$@%*',~?| []() ^" " ; !!! note: space allowed
88
- user-char: insert copy alpha-num "=+-_.;&$%*,'#| "
89
- pass -char: complement make bitset! "^/ ^- @ "
87
+ path-char: complement make bitset! "#"
88
+ user-char: complement make bitset! ":@ "
89
+ host -char: complement make bitset! ":/ "
90
90
s1: s2: none ; in R3, input datatype is preserved - these are now URL strings!
91
91
out: []
92
92
emit : func [ 'w v] [reduce /into [to set-word! w if :v [to string! :v ]] tail out]
@@ -107,7 +107,7 @@ make-port*: func [
107
107
108
108
; optional host [:port]
109
109
opt [
110
- copy s1 any user -char
110
+ copy s1 any host -char
111
111
opt [#":" copy s2 digits (compose /into [port-id: (to integer! s2)] tail out)]
112
112
(unless empty? s1 [attempt [s1: to tuple! s1] emit host s1])
113
113
]
@@ -117,13 +117,14 @@ make-port*: func [
117
117
opt [copy s1 some path-char (emit path s1)]
118
118
119
119
; optional bookmark
120
- opt [#"#" copy s1 some path-char (emit tag s1)]
120
+ opt [#"#" copy s1 to end (emit tag s1)]
121
121
]
122
122
123
123
decode-url : func [ "Decode a URL according to rules of sys/*parse-url." url] [
124
124
--- "This function is bound in the context of sys/*parse-url."
125
125
out: make block! 8
126
126
parse/all url rules
127
+ probe out
127
128
out
128
129
]
129
130
]
Original file line number Diff line number Diff line change 8
8
9
9
~~~start-file~~~ "port"
10
10
11
+ ===start-group=== "decode-url"
12
+ ;@@ https://github.com/rebol/rebol-issues/issues/2380
13
+ --test-- "decode-url-unicode"
14
+ url: decode-url http://example.com/get?q=ščř#kovtička
15
+ --assert url/scheme = 'http
16
+ --assert url/host = "example.com"
17
+ --assert url/path = "/get?q=ščř"
18
+ --assert url/tag = "kovtička"
19
+ --test-- "decode-url-unicode"
20
+ url: decode-url http://švéd:břéťa@example.com:8080/get?q=ščř#kovtička
21
+ --assert url/scheme = 'http
22
+ --assert url/user = "švéd"
23
+ --assert url/pass = "břéťa"
24
+ --assert url/host = "example.com"
25
+ --assert url/port-id = 8080
26
+ --assert url/path = "/get?q=ščř"
27
+ --assert url/tag = "kovtička"
28
+
29
+ ===end-group===
30
+
11
31
===start-group=== "directory port"
12
32
;@@ https://github.com/rebol/rebol-issues/issues/2320
13
33
--test-- "port-issue-2320"
You can’t perform that action at this time.
0 commit comments