{"id":24023869,"url":"https://github.com/awl-s/uri","last_synced_at":"2025-10-13T16:20:10.396Z","repository":{"id":247767536,"uuid":"826795479","full_name":"Awl-S/uri","owner":"Awl-S","description":"This is a robust C library for parsing and managing Uniform Resource Identifiers (URIs). It supports the extraction of various components of a URI, such as the scheme, user info, host, port, path, query, and fragment.","archived":false,"fork":false,"pushed_at":"2024-07-10T12:14:41.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T15:00:56.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Awl-S.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-10T11:49:19.000Z","updated_at":"2024-08-03T08:56:07.000Z","dependencies_parsed_at":"2024-07-10T14:07:31.081Z","dependency_job_id":null,"html_url":"https://github.com/Awl-S/uri","commit_stats":null,"previous_names":["awl-s/uri"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Awl-S%2Furi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Awl-S%2Furi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Awl-S%2Furi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Awl-S%2Furi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Awl-S","download_url":"https://codeload.github.com/Awl-S/uri/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240773225,"owners_count":19855174,"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":"2025-01-08T14:55:34.134Z","updated_at":"2025-10-13T16:20:05.375Z","avatar_url":"https://github.com/Awl-S.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URI Library\n\nThis is a robust C library for parsing and managing Uniform Resource Identifiers (URIs). It supports the extraction of various components of a URI, such as the scheme, user info, host, port, path, query, and fragment.\n\n## Features\n\n- Parse and create a URI structure from a string.\n- Extract different components of the URI.\n- Retrieve the full URI as a string.\n- Memory management for URI structures.\n\n## Getting Started\n\n### Prerequisites\n\n- A C compiler (e.g., GCC)\n- CMake (version 3.18 or higher)\n\n### Installation\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/Awl-S/uri.git\n    cd uri\n    ```\n\n2. Compile the library and example program:\n\n    ```sh\n    gcc -o main main.c uri.c\n    ```\n    \n2. Compile the library and example program using CMake:\n\n    ```sh\n    mkdir build\n    cd build\n    cmake ..\n    make\n    ```\n\n### Usage\n\nInclude the header file in your C program:\n\n```c\n#include \"uri.h\"\n```\n\n### Create and use a URI:\n\n```c\n\n#include \"uri.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n    struct Uri *my_uri = uriCreate(\"http://user:pass@www.example.com:8080/path?query#fragment\");\n    if (!my_uri) {\n        fprintf(stderr, \"Failed to create URI\\n\");\n        return 1;\n    }\n\n    printf(\"Scheme: %s\\n\", uriGetScheme(my_uri));\n    printf(\"User Info: %s\\n\", uriGetUserInfo(my_uri));\n    printf(\"Host: %s\\n\", uriGetHost(my_uri));\n    printf(\"Port: %s\\n\", uriGetPort(my_uri));\n    printf(\"Path: %s\\n\", uriGetPath(my_uri));\n    printf(\"Query: %s\\n\", uriGetQuery(my_uri));\n    printf(\"Fragment: %s\\n\", uriGetFragment(my_uri));\n\n    char *full_uri = uriGetFullUri(my_uri);\n    if (full_uri) {\n        printf(\"Full URI: %s\\n\", full_uri);\n        free(full_uri);\n    }\n\n    uriDestroy(my_uri);\n    return 0;\n}\n```\n\n### API Reference\n#### uriCreate\n\n```c\nstruct Uri *uriCreate(const char *uriString);\n```\nCreates and parses a URI structure from the given string.\n* uriString: URI string.\n* Returns a pointer to the created Uri structure, or nullptr if it fails.\n\n#### uriDestroy\n```c\nvoid uriDestroy(struct Uri *uri); \n```\nDestroys the URI structure and frees allocated memory.\n* uri: Pointer to the Uri structure to destroy.\n\n#### uriGetScheme\n```c\nchar *uriGetScheme(const struct Uri *uri);\n```\nRetrieves the scheme part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the scheme part of the URI.\n\n\n#### uriGetUserInfo\n```c\nchar *uriGetUserInfo(const struct Uri *uri);\n```\nRetrieves the user info part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the user info part of the URI.\n\n#### uriGetHost\n```c\nchar *uriGetHost(const struct Uri *uri);\n```\nRetrieves the host part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the host part of the URI.\n\n#### uriGetPort\n```c\nchar *uriGetPort(const struct Uri *uri);\n```\nRetrieves the port part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the port part of the URI.\n\n#### uriGetPath\n```c\nchar *uriGetPath(const struct Uri *uri);\n```\nRetrieves the path part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the path part of the URI.\n\n#### uriGetQuery\n```c\nchar *uriGetQuery(const struct Uri *uri);\n```\nRetrieves the query part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the query part of the URI.\n\n#### uriGetFragment\n```c\nchar *uriGetFragment(const struct Uri *uri);\n```\nRetrieves the fragment part of the URI.\n\n* uri: Pointer to the Uri structure.\n* Returns the fragment part of the URI.\n\n#### uriGetFullUri\n```c\nchar *uriGetFullUri(const struct Uri *uri);\n```\nRetrieves the full URI as a string.\n\n* uri: Pointer to the Uri structure.\n* Returns the full URI string.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawl-s%2Furi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawl-s%2Furi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawl-s%2Furi/lists"}