{"id":30227838,"url":"https://github.com/ismacortgtz/pocket-http","last_synced_at":"2026-04-17T01:02:21.863Z","repository":{"id":305722123,"uuid":"1023732281","full_name":"IsmaCortGtz/pocket-http","owner":"IsmaCortGtz","description":"A lightweight, cross-platform HTTP/HTTPS client library for C++17 in an ultra-compact package.","archived":false,"fork":false,"pushed_at":"2026-03-07T21:26:25.000Z","size":1598,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-08T02:51:25.288Z","etag":null,"topics":["bearssl","cpp","cpp17","http","https","library","lightweight"],"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/IsmaCortGtz.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-21T15:54:22.000Z","updated_at":"2026-03-07T21:26:28.000Z","dependencies_parsed_at":"2025-10-23T23:22:36.029Z","dependency_job_id":"49fe3a08-65ae-41e0-9b12-1115b372e140","html_url":"https://github.com/IsmaCortGtz/pocket-http","commit_stats":null,"previous_names":["ismacortgtz/pocket-http"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/IsmaCortGtz/pocket-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsmaCortGtz%2Fpocket-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsmaCortGtz%2Fpocket-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsmaCortGtz%2Fpocket-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsmaCortGtz%2Fpocket-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IsmaCortGtz","download_url":"https://codeload.github.com/IsmaCortGtz/pocket-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IsmaCortGtz%2Fpocket-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31910585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bearssl","cpp","cpp17","http","https","library","lightweight"],"created_at":"2025-08-14T18:51:50.571Z","updated_at":"2026-04-17T01:02:21.830Z","avatar_url":"https://github.com/IsmaCortGtz.png","language":"C++","readme":"# pocket-http\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FIsmaCortGtz%2Fpocket-http.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FIsmaCortGtz%2Fpocket-http?ref=badge_shield)\n![Cpp17](https://img.shields.io/badge/Made_for-C++17-blue)\n![HTTP](https://img.shields.io/badge/Implements-HTTP-red)\n![HTTPS](https://img.shields.io/badge/Implements-HTTPS-green)\n\n\nA lightweight, cross-platform HTTP/HTTPS client library for C++17 in an ultra-compact package.\n\n## 🚀 Key Features\n\n- **Zero Dependencies**: Compiles with a single command without linking any external libraries.\n- **Cross-Platform**: Works seamlessly on Linux, macOS, and Windows.\n- **HTTP/HTTPS Support**: Built-in TLS support via embedded [`BearSSL`](https://bearssl.org/) or [`Mbed-TLS`](https://github.com/Mbed-TLS/mbedtls).\n- **Memory Efficient**: Chunked streaming keeps memory usage low and constant.\n- **Automatic Compression**: Built-in Gzip and Deflate decompression via [`miniz`](https://github.com/richgel999/miniz).\n- **Smart Socket Pooling**: Automatic connection reuse with intelligent cleanup.\n- **Production Ready**: Timeout handling, connection management, and error recovery.\n\n## 📦 What's Included\n\n### Core Components\n\n- **HTTP Client**: Full HTTP/1.1 implementation with chunked transfer encoding.\n- **TLS Support**: Secure HTTPS connections via embedded [`BearSSL`](https://bearssl.org/) or [`Mbed-TLS`](https://github.com/Mbed-TLS/mbedtls).\n- **Socket Pool**: Automatic connection reuse with timestamp-based cleanup.\n- **Decompression**: Automatic Gzip/Deflate handling via [`miniz`](https://github.com/richgel999/miniz).\n- **Headers Management**: Complete HTTP headers parsing and manipulation.\n\n### Embedded Libraries\n\n- [**`BearSSL`**](https://bearssl.org/): Lightweight TLS implementation (no OpenSSL dependency).\n- [**`Mbed-TLS`**](https://github.com/Mbed-TLS/mbedtls): TLS implementation.\n- [**`miniz`**](https://github.com/richgel999/miniz): High-performance compression library.\n\n## 🏗️ Architecture\n\n### Memory Management\n\n- **Streaming Architecture**: Processes data in chunks (`16KB`)\n- **Constant Memory Usage**: Memory footprint remains stable regardless of response size.\n- **Smart Buffering**: Automatic buffer sizing based on Content-Length and compression.\n\n### Connection Management\n\n- **Socket Pool**: Reuses connections for improved performance.\n- **Automatic Cleanup**: Removes expired connections based on configurable timeout.\n- **Connection State**: Tracks last usage timestamp for each socket.\n- **Graceful Handling**: Detects and recovers from server-side disconnections.\n\n## 🛠️ Building\n\nFirst of all, you need to clone the repository.\n\n```bash\ngit clone https://github.com/IsmaCortGtz/pocket-http.git\n\n# If you want to use mbedtls you need to fetch submodules\ngit submodule update --init --recursive\n```\n\nThen, if you want to use `HTTPS` with `BearSSL` or `MbedTLS` you can privide your own `certs.hpp` file on `include/pockethttp/Sockets/certs.hpp`, then import it before any other `pockethttp` header file and define `USE_POCKET_HTTP_MOZILLA_ROOT_CERTS` at compilation time. ~~The default one is created from the [`Mozilla CA Certificates`](https://curl.se/docs/caextract.html)~~.\n\n```bash\n# This command will create the certs.hpp file\n\n# cryptography library is needed, install it with 'pip install cryptography'\n\npython scripts/parse.py cacert.pem\n```\n\n### Building\n\nYou can build with `CMake`, I recommend you to use `Ninja`, but you can use `Make` if you want to,\n\n```bash\n# Create build directory\nmkdir build\ncd build\n\n# Build\ncmake .. -G Ninja -DUSE_POCKET_HTTP_MBEDTLS=ON\nninja\n```\n\n## 📚 Usage\n\nYou can see simple examples in [`examples/`](./examples/):\n\n- [basic_request.cpp](./examples/basic_request.cpp)\n- [download.cpp](./examples/download.cpp)\n- [form_data.cpp](./examples/form_data.cpp)\n- [form_urlencoded.cpp](./examples/form_urlencoded.cpp)\n- [send_file.cpp](./examples/send_file.cpp)\n- [send_json.cpp](./examples/send_json.cpp)\n- [systemcerts.cpp](./examples/systemcerts.cpp)\n\n## 📋 API Reference\n\nTODO\n\n## 🔧 Configuration\n\n### Compile-Time Options\n\n- `USE_POCKET_HTTP_BEARSSL` (Default: `OFF`): Enable HTTPS support with `BearSSL`. Without this flag the TLSSocket wont be registered in SocketPool, so you can register your own implementation for HTTPS using a `SocketWrapper`.\n- `USE_POCKET_HTTP_MBEDTLS` (Default: `OFF`): Enable HTTPS support with `MbedTLS` (recommended). Without this flag the `MbedTLSSocket` wont be registered in SocketPool, so you can register your own implementation for HTTPS using a `SocketWrapper`.\n- `USE_POCKET_HTTP_LOG` (Default: `OFF`): Enable detailed information logging for debugging (only `std::cout`).\n- `USE_POCKET_HTTP_ERR` (Default: `OFF`): Enable detailed error logging for debugging (only `std::cerr`).\n- `USE_POCKET_HTTP_MOZILLA_ROOT_CERTS` (Default: `OFF`): Enable Mozilla Root Certificates for HTTPS.\n\n## 🎯 Use Cases\n\nPerfect for:\n\n- **Embedded Systems**: Minimal memory footprint and zero dependencies\n- **Microservices**: Lightweight HTTP client for service communication  \n- **IoT Applications**: Efficient HTTPS communication for resource-constrained devices\n- **Standalone Tools**: No dependency hell, single-file distribution\n- **Cross-Platform Apps**: Write once, compile anywhere\n- **Performance-Critical Applications**: Streaming architecture prevents memory spikes\n\n## 🔄 How It Works\n\n### Streaming Architecture\n\n1. **Request Sending**: Large payloads sent in 16KB chunks\n2. **Response Receiving**: Data processed as it arrives, never buffering entire response\n3. **Memory Management**: Constant memory usage regardless of payload size\n4. **Compression**: Automatic detection and decompression of Gzip/Deflate content\n\n### Socket Pool Management\n\n1. **Pool Creation**: Maintains pool of reusable connections per host:port\n2. **Usage Tracking**: Each socket tagged with last activity timestamp\n3. **Automatic Cleanup**: Expired connections removed based on timeout\n4. **Failure Recovery**: Detects closed connections and creates new ones\n\n## 📊 Performance\n\n- **Memory**: Constant ~64KB maximum usage regardless of response size\n- **Speed**: Connection reuse eliminates handshake overhead  \n- **Compression**: Automatic decompression with minimal memory overhead\n- **TLS**: Optimized BearSSL and [`Mbed-TLS`](https://github.com/Mbed-TLS/mbedtls) provides fast HTTPS with small footprint\n\n## 🤝 Contributing\n\nThis is a focused, production-ready library. Contributions should maintain the zero-dependency philosophy and cross-platform compatibility.\n\n## 📜 License\n\n- pocket-http: MIT. Copyright (c) 2025 Ismael Cortés Gutiérrez.\n- miniz: MIT from [richgel999/miniz](https://github.com/richgel999/miniz). \nCopyright 2013-2014 RAD Game Tools and Valve Software. Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC.\n- bearssl: MIT from [bearssl.org](https://bearssl.org/). \nCopyright (c) 2016 Thomas Pornin \u003cpornin@bolet.org\u003e.\n- base64: Base64 encoder/decoder library: MIT from [tobiaslocker/base64](). Copyright (c) 2019 Tobias Locker.\n- mbedTLS: [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) or [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) from [Mbed-TLS/mbedtls](https://github.com/Mbed-TLS/mbedtls). (Using [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html))\n\n---\n\n**pocket-http** - When you need HTTP/HTTPS that just works, everywhere, with zero hassle.\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FIsmaCortGtz%2Fpocket-http.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FIsmaCortGtz%2Fpocket-http?ref=badge_large)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fismacortgtz%2Fpocket-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fismacortgtz%2Fpocket-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fismacortgtz%2Fpocket-http/lists"}