@@ -20,7 +20,7 @@ URI scheme (e.g., "http", "https", "ftp").
2020abbrev Scheme := String
2121
2222/--
23- User information component that usually contains the username and password.
23+ User information component containing the username and password.
2424-/
2525abbrev UserInfo := String
2626
@@ -29,7 +29,7 @@ Host component of a URI, supporting domain names and IP addresses.
2929-/
3030inductive Host
3131 /--
32- A registered name (typically a domain name).
32+ A registered name (e.g., a domain name).
3333 -/
3434 | name (name : String)
3535
@@ -58,7 +58,7 @@ instance : Repr Host where
5858 | Host.ipv6 a => repr "ipv6" (toString a)
5959
6060/--
61- TCP number port.
61+ TCP port number .
6262-/
6363abbrev Port := UInt16
6464
@@ -70,7 +70,7 @@ on the network.
7070 -/
7171structure Authority where
7272 /--
73- Optional user information like user and password.
73+ Optional user information such as username and password.
7474 -/
7575 userInfo: Option UserInfo := none
7676
@@ -162,12 +162,12 @@ inductive RequestTarget where
162162 | absoluteForm (uri : URI)
163163
164164 /--
165- Request target using the authority-form, typically for CONNECT requests.
165+ Request target using the authority-form (used for CONNECT requests) .
166166 -/
167167 | authorityForm (authority : URI.Authority)
168168
169169 /--
170- Asterisk-form request target, typically used with OPTIONS requests.
170+ Asterisk-form request target ( used with OPTIONS requests) .
171171 -/
172172 | asteriskForm
173173deriving Inhabited, Repr
@@ -223,8 +223,8 @@ private def byteToHex (b : UInt8) : ByteArray :=
223223 ByteArray.mk #['%' .toUInt8, hi, lo]
224224
225225/--
226- Encodes a string as a URI component by percent-encoding all characters
227- -- /
226+ Encodes a string as a URI component by percent-encoding all characters.
227+ -/
228228def encodeURIComponent (s : String) : ByteArray :=
229229 s.toUTF8.foldl (init := ByteArray.emptyWithCapacity s.utf8ByteSize) fun acc c =>
230230 if isUnreserved c then acc.push c else acc.append (byteToHex c)
0 commit comments