Skip to content

Commit 0c289d9

Browse files
committed
fix: problem with URI, for some reason it was upper cased in github
1 parent 0218337 commit 0c289d9

File tree

14 files changed

+35
-39
lines changed

14 files changed

+35
-39
lines changed

Http/Data.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import Http.Data.Method
44
import Http.Data.Request
55
import Http.Data.Status
66
import Http.Data.Response
7-
import Http.Data.Uri
7+
import Http.Data.URI
88
import Http.Data.Version

Http/Data/Request.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Http.Data.Headers
22
import Http.Data.Version
33
import Http.Data.Method
44
import Http.Data.Body
5-
import Http.Data.Uri
5+
import Http.Data.URI
66
import Http.Classes
77

88
namespace Http.Data
@@ -12,15 +12,15 @@ open Http.Classes
1212
headers and a [Incoming] body, that can be a stream. -/
1313
structure Request where
1414
method : Method
15-
uri : Uri
15+
uri : URI
1616
version : Version
1717
headers : Headers
1818
deriving Repr, Inhabited
1919

2020
namespace Request
2121

2222
def empty : Request :=
23-
Request.mk Method.get Uri.empty Version.v10 Inhabited.default
23+
Request.mk Method.get URI.empty Version.v10 Inhabited.default
2424

2525
instance : Canonical .text Request where
2626
repr r :=

Http/Data/Status.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ instance : Canonical .text Status where
248248
| .lengthRequired => "Length Required"
249249
| .preconditionFailed => "Precondition Failed"
250250
| .payloadTooLarge => "Request Entity Too Large"
251-
| .uriTooLong => "Request Uri Too Long"
251+
| .uriTooLong => "Request URI Too Long"
252252
| .unsupportedMediaType => "Unsupported Media Type"
253253
| .rangeNotSatisfiable => "Requested Range Not Satisfiable"
254254
| .expectationFailed => "Expectation Failed"

Http/Data/URI/Authority.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import CaseInsensitive
22
import Http.Classes
33

4-
namespace Http.Data.Uri
4+
namespace Http.Data.URI
55
open Http.Classes
66

77
/-- TCP number port -/

Http/Data/URI/Grammar.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Parse
22
import Parse.DSL
33

4-
namespace Http.Data.Uri
4+
namespace Http.Data.URI
55

66
/-! This code defines an incremental parser for parsing different components of a URI. -/
77

Http/Data/URI/Parser.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import Http.Data.Uri.Grammar
2-
import Http.Data.Uri
1+
import Http.Data.URI.Grammar
2+
import Http.Data.URI
33

4-
namespace Http.Data.Uri
4+
namespace Http.Data.URI
55

6-
structure Uri.State where
6+
structure URI.State where
77
authority : Option String
88
path : Option String
99
query : Option String
@@ -15,9 +15,9 @@ structure Uri.State where
1515
/-! Defines an incremental parser handler using the `Grammar` module. This parser is designed to handle
1616
URI components incrementally.
1717
-/
18-
abbrev Parser := Grammar.Data Uri.State
18+
abbrev Parser := Grammar.Data URI.State
1919

20-
private def setField (func: String → Uri.State → Uri.State) : Nat → Nat → ByteArray → Uri.State → IO (Uri.State × Nat) :=
20+
private def setField (func: String → URI.State → URI.State) : Nat → Nat → ByteArray → URI.State → IO (URI.State × Nat) :=
2121
fun st en bs acc => pure (func (String.fromAscii $ bs.extract st en) acc, 0)
2222

2323
/-- Creates a new parser structure. This parser uses various field-setting functions to update the
@@ -44,7 +44,7 @@ def Parser.feed (parser: Parser) (data: ByteArray) : IO Parser :=
4444

4545
/-- Retrieves the parsed URI data from the parser. This function extracts the accumulated URI
4646
information from the parser. -/
47-
def Parser.data (parser: Parser) : Except Nat Uri :=
47+
def Parser.data (parser: Parser) : Except Nat URI :=
4848
if parser.error ≠ 0 then
4949
.error parser.error
5050
else
@@ -57,4 +57,4 @@ def Parser.data (parser: Parser) : Except Nat Uri :=
5757
| [] => (none, none)
5858
| _ => panic "impossible uri"
5959
let authority := Authority.mk userinfo host port
60-
.ok (Uri.mk authority state.path state.query state.fragment)
60+
.ok (URI.mk authority state.path state.query state.fragment)

Http/Data/URI/Scheme.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import CaseInsensitive
22
import Http.Classes
33

4-
namespace Http.Data.Uri
4+
namespace Http.Data.URI
55
open Http.Classes
66

77
/-- The standard schemes described in the HTTP core semantics. -/

Http/Data/Uri.lean

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Http.Data.Uri.Authority
2-
import Http.Data.Uri.Scheme
3-
import Http.Data.Uri.Query
1+
import Http.Data.URI.Authority
2+
import Http.Data.URI.Scheme
3+
import Http.Data.URI.Query
44
import Http.Util.Format
55
import Http.Util
66
import Http.Classes
@@ -14,22 +14,22 @@ open Lean
1414
1515
* Reference: https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
1616
-/
17-
structure Uri where
18-
authority : Uri.Authority := {}
17+
structure URI where
18+
authority : URI.Authority := {}
1919
path : Option String := none
2020
query : Option String := none
2121
fragment : Option String := none
2222
deriving BEq, Repr, Inhabited
2323

24-
def Uri.encode (input: String) : String :=
24+
def URI.encode (input: String) : String :=
2525
input.toUTF8.foldl (λs c => s ++ encodeChar c) ""
2626
where
2727
encodeChar char :=
2828
if (char ≥ 97 ∧ char ≤ 122) ∨ (char ≥ 65 ∧ char ≤ 90) ∨ (char ≥ 48 ∧ char ≤ 57)
2929
then (Char.ofNat (UInt8.toNat char)).toString
3030
else s!"%{(toHex char.toNat).toUpper}"
3131

32-
def Uri.componentDecode (input: String) : Option String := Id.run do
32+
def URI.componentDecode (input: String) : Option String := Id.run do
3333
let mut result := ByteArray.empty
3434
let mut acc := 0
3535
let mut start := none
@@ -65,7 +65,7 @@ def Uri.componentDecode (input: String) : Option String := Id.run do
6565

6666
return String.fromAscii result
6767

68-
instance : Canonical .text Uri where
68+
instance : Canonical .text URI where
6969
repr u :=
7070
let authority := Canonical.text u.authority
7171
let path := Option.getD u.path ""
@@ -74,6 +74,6 @@ instance : Canonical .text Uri where
7474
let notEncoded := String.join [authority, path, query, fragment]
7575
notEncoded
7676

77-
namespace Uri
77+
namespace URI
7878

79-
def empty : Uri := Uri.mk Inhabited.default none none none
79+
def empty : URI := URI.mk Inhabited.default none none none

Http/IO/Client.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Http.Protocols.Http1.Parser
22
import Http.Protocols.Http1.Data
33
import Http.IO.Server.Config
44
import Http.IO.Server.Connection
5-
import Http.Data.Uri.Parser
5+
import Http.Data.URI.Parser
66
import Http.Data
77
import Http.Util
88
import Http.Classes

Http/IO/Server.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Http.Protocols.Http1.Parser
22
import Http.Protocols.Http1.Data
33
import Http.IO.Server.Config
44
import Http.IO.Server.Connection
5-
import Http.Data.Uri.Parser
5+
import Http.Data.URI.Parser
66
import Http.Data
77
import Http.Util
88
import Http.Classes

0 commit comments

Comments
 (0)