{"id":19494602,"url":"https://github.com/jrialland/smallclient","last_synced_at":"2025-10-08T16:13:53.390Z","repository":{"id":82046046,"uuid":"475813774","full_name":"jrialland/smallclient","owner":"jrialland","description":"A small http(s) client in C++","archived":false,"fork":false,"pushed_at":"2022-03-30T16:02:50.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-29T07:43:33.159Z","etag":null,"topics":["cplusplus","cpp","cpp11","http","http-client"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jrialland.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":"2022-03-30T09:43:10.000Z","updated_at":"2022-03-30T09:46:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"bdb78aff-e7b1-4ae2-a44c-525af014f7d0","html_url":"https://github.com/jrialland/smallclient","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jrialland/smallclient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrialland%2Fsmallclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrialland%2Fsmallclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrialland%2Fsmallclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrialland%2Fsmallclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrialland","download_url":"https://codeload.github.com/jrialland/smallclient/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrialland%2Fsmallclient/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278973849,"owners_count":26078315,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cplusplus","cpp","cpp11","http","http-client"],"created_at":"2024-11-10T21:30:48.765Z","updated_at":"2025-10-08T16:13:53.372Z","avatar_url":"https://github.com/jrialland.png","language":"C++","readme":"This is a small http client library for C++.\n\nIt has the following features:\n\n* Compiles with C++11\n* Has support for https, using [OpenSSL](https://www.openssl.org/)\n* Allows to simply remove https support at compilation\n* Supports [Chuncked transfer encoding](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#chunked)\n* Supports automatic following of 301 \u0026 302 redirects \n\nCompiling\n---------\n\n* Example using CMake\n\n```cmake\ncmake_minimum_required(VERSION 3.7)\nproject(myapp)\n\nset(CMAKE_CXX_STANDARD 11) # minimum C++ standard\n\nfind_package(OpenSSL REQUIRED)\n\nset(SOURCE_FILES main.cpp libs/smallclient/smallclient.cpp)\n\nadd_executable(myapp ${SOURCE_FILES})\ntarget_include_directories(myapp PRIVATE libs/smallclient)\ntarget_link_libraries(myapp OpenSSL::SSL)\n\n# optional compilation settings\ntarget_compile_definitions(myapp\n    PUBLIC SMALLCLIENT_READ_BUFFER_SIZE=8192\n    PUBLIC SMALLCLIENT_SSL_VERIFY=1\n)\n```\n\nCompile without Support for SSL\n-------------------------------\n```cpp\n#define SMALLCLIENT_NO_SSL_SUPPORT\n#include \"smallclient.hpp\"\n\n```\n\nExamples\n--------\n\n* Simple GET request\n--------------------\n```cpp\nusing namespace smallclient;\n\nRequest::get(\"https://example.com/?param=value\").execute();\n// or\nRequest::get(\"https://example.com\").parameter(\"param\", \"value\").execute();\n\n```\n\n* JSON POST\n\n```cpp\n    // posted json data\n    std::string payload=\"{'test':'example', 'intvalue':42}\";\n    std::replace(payload.begin(), payload.end(), '\\'', '\"');\n\n    // response will be stored here\n    std::string result;\n\n    auto request = Request::post(\"https://example.com/api\")\n        .header(\"Content-Type\", \"application/json\")\n        .body(payload);\n\n    // fail if response is not ok\n    request.callback.on_start = [](int status_code, const std::string\u0026 message) {\n        if(status_code != 200) {\n            throw std::runtime_error(std::to_string(status_code) + \" \" + message);\n        }\n    };\n\n    // get json response into result\n    request.callback.on_data = [\u0026result](const char*data, int len) {\n        result.append(std::string(data, len));\n    };\n\n    request.execute();\n\n    std::cout \u003c\u003c result \u003c\u003c std::endl;\n```\n\n* PUT a file\n\n```cpp\n    std::ifstream file;\n    file.open(\"myfile.txt\", ios_base::in | ios_base::binary);\n\n    URI uri(\"https://server/dav/folder/myfile.txt\");\n\n    ResponseCallback rc;\n    rc.on_start = [](int status_code, const std::string\u0026 message) {\n        std::cout \u003c\u003c status_code \u003c\u003c \" \" \u003c\u003c message \u003c\u003c std::endl;\n    };\n\n    query(uri, \"PUT\", {}, file, callback);\n\n```\n\n* Following redirects\n\n```\n    Request::get(\"https://example.com/?param=value\")\n         .follow_redirects()\n         .execute();\n```\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrialland%2Fsmallclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrialland%2Fsmallclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrialland%2Fsmallclient/lists"}