[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"PxC567pny6":3},"# lean-url \n\nA library implementing URLs (aka URIs/IRIs) and their API according to the whatwg [URL spec](https://url.spec.whatwg.org) in [Lean 4](https://lean-lang.org/).\n\nThis library uses the term \"URL\" rather than \"URI\" for the same reason(s) as the whatwg spec: \"URI and IRI are just confusing. In practice a single algorithm is used for both so keeping them distinct is not helping anyone. URL also easily wins the search result popularity contest.\"\n\n## TODO\n\n+ IDNA, punycode, etc. (see LeanUrl/Parser/Unicode.lean). The current implementation of `domainToUnicode` is effectively a placeholder.\n\n+ Support for non-UTF8 encodings.\n\n+ There is currently a significant amount of low hanging fruit in terms of efficiency gains.\n\n## Examples:\n\n```\nimport LeanUrl.Parser.Basic\n\nopen LeanUrl.Parser\n\n-- URL parsing\n\n/-\nExcept.ok {\n  scheme := \"http\",\n  username := some \"user\",\n  password := some \"pass\",\n  host := some (LeanUrl.Host.domain { val := \"foo\", h := _ }),\n  port := some 21,\n  path := Sum.inr #[\"bar;par\"],\n  query := some \"b\",\n  fragment := some \"c\",\n  blobUrlEntry := none\n}\n-/\n#eval LeanUrl.Parser.parseUrl' \"http://user:pass@foo:21/bar;par?b#c\" (base := none)\n\n/-\nExcept.ok {\n  scheme := \"http\",\n  username := some \"user\",\n  password := some \"pass\",\n  host := some (LeanUrl.Host.domain { val := \"foo\", h := _ }),\n  port := some 21,\n  path := Sum.inr #[\"bar;par\"],\n  query := some \"b\",\n  fragment := some \"c\",\n  blobUrlEntry := none\n}\n-/\n#eval LeanUrl.Parser.parseUrl'\n  (input := \"http://user:pass@foo:21/bar;par?b#c\")\n  (base := some \"http://example.org/foo/bar\")\n\n-- URL serialization\n\n/-- info: Except.ok \"file://host/C:\" -/\n#guard_msgs in #eval\n  (parseUrl'\n    (input := \"C|\")\n    (base := \"file://host/D:/dir1/dir2/file\")\n  ).map (fun url => url.serialize false)\n\n/-- info: Except.ok \"http://255.255.255.255/\" -/\n#guard_msgs in #eval\n  (parseUrl'\n    (input := \"http://0xffffffff\")\n    (base := \"http://other.com/\")\n  ).map (fun url => url.serialize false)\n```\n\n\n\n\n",1780846780022]