{"id":18779394,"url":"https://github.com/zostay/uri-normalize","last_synced_at":"2025-12-18T00:30:19.749Z","repository":{"id":66558105,"uuid":"64447254","full_name":"zostay/URI-Normalize","owner":"zostay","description":"Normalize URIs according to RFC 3986","archived":false,"fork":false,"pushed_at":"2016-08-10T21:52:08.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T10:29:13.180Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zostay.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-29T03:27:23.000Z","updated_at":"2016-07-29T03:27:36.000Z","dependencies_parsed_at":"2023-04-06T08:03:41.193Z","dependency_job_id":null,"html_url":"https://github.com/zostay/URI-Normalize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FURI-Normalize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FURI-Normalize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FURI-Normalize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FURI-Normalize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zostay","download_url":"https://codeload.github.com/zostay/URI-Normalize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239690598,"owners_count":19681129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T20:19:54.203Z","updated_at":"2025-12-18T00:30:17.686Z","avatar_url":"https://github.com/zostay.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nURI::Normalize - Normalize URIs according to RFC 3986\n\n# VERSION\n\nversion 0.002\n\n# SYNOPSIS\n\n    use URI;\n    use URI::Normalize qw( normalize_uri remove_dot_segments );\n    my $uri = URI-\u003enew('HTTPS://www.Example.com:443/../test/../foo/index.html');\n\n    say normalize_uri($uri);       #\u003e https://www.example.com/foo/index.html\n    say remove_dot_segments($uri); #\u003e HTTPS://www.Example.com:443/foo/index.html\n\n# DESCRIPTION\n\nSection 6 of RFC 3986 describes a process of URI normalization. This implements\nsyntax-based normalization and may include some schema-based and protocol-based\nnormalization. This includes implementing the `remove_dot_segments` algorithm\ndescribed in Section 5.2.3 of the RFC.\n\nThis has a number of useful applications in allowing URIs to be compared with\nfewer false negatives. For example, all of the following URIs will normalize to\nthe same value:\n\n    HTTPS://www.example.com:443/../test/../foo/index.html\n    https://WWW.EXAMPLE.COM/./foo/index.html\n    https://www.example.com/%66%6f%6f/index.html\n    https://www.example.com/foo/index.html\n\nThat is, they will all be normalized into the last value.\n\n# SUBROUTINES\n\n## normalize\\_uri\n\n    $normal_uri = normalize_uri($uri);\n    $normal_uri = normalize_uri($str);\n\nGiven a URI object or a string, this routine basically just calls the\n`canonical` method and [\"remove\\_dot\\_segments\"](#remove_dot_segments) on the URI and returns the\nresult as a [URI](https://metacpan.org/pod/URI) object.\n\nThe original URI is left unchanged.\n\n## remove\\_dot\\_segments\n\n    $clean_path_uri = remove_dot_segments($uri);\n    $clean_path_uri = remove_dot_segments($str);\n\nGiven a URI object or a string, this routine will remove dot segments (i.e, \".\"\nand \"..\") from the path of the URI.\n\n# CAVEATS\n\nAs RFC 3986 notes, normalization is a tool used to help identify whether\none URI is equivalent to another. This does not, however, imply that the\nresources identified by two URIs that are different byte-for-byte but normalize\nto the same value will be the same. For example, the presence of \"/./\" in the\npath might be significant to an implementation, or using octet-encoding (e.g.,\n\"%3a\") instead of the character represented might represent a different actual\nresource. So use normalization judiciously.\n\nThis implementation of normalization is far from comprehensive. There are many\nnormalizations you may wish to perform. In that case, you may want to look into\n[URL::Normalize](https://metacpan.org/pod/URL::Normalize), which provides a more comprehensive list of normalizations,\nsome of which go against the letter of RFC 3986, but can be valuable in certain\napplications.\n\nThis implementation does not include the full gamut of what is keeping with the\nletter of RFC 3986, but might be expanded to include additional normalizations\nin the future.\n\nIf you know of a normalization that could be implemented here: patches welcome.\n\n# AUTHOR\n\nAndrew Sterling Hanenkamp \u003chanenkamp@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2016 by Qubling Software.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Furi-normalize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzostay%2Furi-normalize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Furi-normalize/lists"}