{"id":13812541,"url":"https://github.com/fetisov/httpio","last_synced_at":"2025-05-14T22:30:45.555Z","repository":{"id":89877606,"uuid":"67438908","full_name":"fetisov/httpio","owner":"fetisov","description":"Stand-Alone Cross Platform request parser and response generator for the HTTP protocol","archived":false,"fork":false,"pushed_at":"2016-09-06T01:46:19.000Z","size":22,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T07:38:52.820Z","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/fetisov.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":"2016-09-05T17:22:36.000Z","updated_at":"2024-11-05T12:57:53.000Z","dependencies_parsed_at":"2023-06-15T23:30:40.548Z","dependency_job_id":null,"html_url":"https://github.com/fetisov/httpio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetisov%2Fhttpio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetisov%2Fhttpio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetisov%2Fhttpio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetisov%2Fhttpio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fetisov","download_url":"https://codeload.github.com/fetisov/httpio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239453,"owners_count":22037713,"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-08-04T04:00:53.112Z","updated_at":"2025-05-14T22:30:45.186Z","avatar_url":"https://github.com/fetisov.png","language":"C","funding_links":[],"categories":["Protocols"],"sub_categories":["Network protocols"],"readme":"# httpio\nCross Platform parser and response generator for the HTTP protocol.\n\nLibrary has the simple API to embed to the custom systems.\n\nParser functions:\n- Parses the HTTP stream on the fly\n- Does not use the dynamic allocation (uses predefined connection buffer as the simple pool)\n- Not used space of the connection buffer can be used as the network receiving buffer\n- Supports the keep-alive multiple requests and various types of POST request\n\nGenerator functions:\n- As well as the parser it does not use the dynamic allocation\n- Organized by a ring buffer\n- Supports the chunked transfer encoding\n\n# Parser example (stdin instead the socket)\n```c\n#include \u003cstdio.h\u003e\n#include \"httpio.h\"\n\nstatic char in_pool[1024];\n\nint main(int argc, const char **argv)\n{\n    FILE *f;\n    httpi_t *in;\n    f = argc == 2 ? fopen(argv[1], \"rb\") : stdin;\n    in = httpi_init(in_pool, 1024);\n    while (1)\n    {\n        int size;\n        char *data;\n        int status = httpi_pull(in);\n        switch (status)\n        {\n        case HTTP_IN_NODATA:\n            /* data input */\n            httpi_get_state(in, \u0026data, \u0026size);\n            size = fread(data, 1, size, f);\n            httpi_push(in, data, size);\n            if (size == 0) return 0;\n            continue;\n        case HTTP_IN_REQUEST:\n            printf(\"page %s requested\\n\", httpi_request(in)-\u003euri);\n            continue;\n        case HTTP_IN_POSTDATA:\n            printf(\"new chunk of POST data \\\"%s\\\"\\n\", httpi_posted(in)-\u003ename);\n            continue;\n        case HTTP_IN_FINISHED:\n            printf(\"request finished\\n\");\n            continue;\n        default:\n            printf(\"invalid request!\\n\");\n            return 0;\n        }\n    }\n}\n```\nExample input:\n```http\nPOST /cgi-bin/login.cgi HTTP/1.1\nHost: www.tutorialspoint.com\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 35\nAccept-Language: en-us\nAccept-Encoding: gzip, deflate\nConnection: Keep-Alive\n\nlogin=Petya%20Vasechkin\u0026password=qq\n```\nExample output:\n```\npage /cgi-bin/login.cgi requested\nnew chunk of POST data \"login\"\nnew chunk of POST data \"password\"\nrequest finished\n```\n\n# Response generator example (stdout instead the socket)\n```c\n#include \u003cstdio.h\u003e\n#include \"httpio.h\"\n\nstatic char out_pool[1024];\n\nint main(int argc, const char **argv)\n{\n    FILE *f;\n    httpo_t *out;\n    http_resp_t resp;\n    char *data;\n    int size;\n    out = httpo_init(out_pool, 1024);\n    http_resp_init(\u0026resp, 200, MIME_TEXT_HTML, RESPF_KEEPALIVE | RESPF_CHUNKED | RESPF_NOCACH);\n    httpo_write_resp(out, \u0026resp);\n    httpo_write_data(out, \"first data chunk\", 16);\n    httpo_write_data(out, \"the second data chunk\", 21);\n    httpo_finished(out);\n    httpo_state(out, \u0026data, \u0026size);\n    fwrite(data, 1, size, stdout);\n    return 0;\n}\n```\n\nExample output:\n```http\nHTTP/1.1 200 OK\nContent-Language: en\nContent-Type: text/html\nConnection: keep-alive\nCache-Control: no-store, no-cache\nTransfer-Encoding: chunked\n\n10\nfirst data chunk\n15\nthe second data chunk\n0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetisov%2Fhttpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffetisov%2Fhttpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetisov%2Fhttpio/lists"}