All Projects → AndsonYe → MultipartEncoder

AndsonYe / MultipartEncoder

Licence: MIT License
C++ implementation of encoding HTTP multipart/form-data into a string buffer for POST action in HTTP clients

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to MultipartEncoder

nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (-28.89%)
Mutual labels:  http-client, multipart
clj-http-hystrix
A Clojure library to wrap clj-http requests as hystrix commands
Stars: ✭ 21 (-53.33%)
Mutual labels:  http-client
libashttp
A C++ async HTTP client library to use in asynchronous applications while communicating with REST services.
Stars: ✭ 51 (+13.33%)
Mutual labels:  http-client
desktop
A native GUI application that makes it easy to explore and test Serverless Framework applications built on AWS Lambda.
Stars: ✭ 42 (-6.67%)
Mutual labels:  http-client
centra
Core Node.js HTTP client
Stars: ✭ 52 (+15.56%)
Mutual labels:  http-client
SimplecURL
Easy to use HTTP Client for PHP
Stars: ✭ 14 (-68.89%)
Mutual labels:  http-client
lhc
🚀 Advanced HTTP Client for Ruby. Fueled with interceptors.
Stars: ✭ 32 (-28.89%)
Mutual labels:  http-client
Rester
A command line tool to test (REST) APIs
Stars: ✭ 42 (-6.67%)
Mutual labels:  http-client
RESTEasy
REST API calls made easier
Stars: ✭ 12 (-73.33%)
Mutual labels:  http-client
rq
A nicer interface for golang stdlib HTTP client
Stars: ✭ 40 (-11.11%)
Mutual labels:  http-client
ivar
Ivar is an adapter based HTTP client that provides the ability to build composable HTTP requests.
Stars: ✭ 14 (-68.89%)
Mutual labels:  http-client
curly.hpp
Simple cURL C++17 wrapper
Stars: ✭ 48 (+6.67%)
Mutual labels:  http-client
form-data
Spec-compliant FormData implementation for Node.js
Stars: ✭ 73 (+62.22%)
Mutual labels:  form-data
heroshi
Heroshi – open source web crawler.
Stars: ✭ 51 (+13.33%)
Mutual labels:  http-client
monolog-http
A collection of monolog handlers that use a PSR-18 HTTP Client to send your logs
Stars: ✭ 34 (-24.44%)
Mutual labels:  http-client
foxy
Session-based Beast/Asio wrapper requiring C++14
Stars: ✭ 61 (+35.56%)
Mutual labels:  http-client
multipart-download
Speed up download of a single file with multiple HTTP GET connections running in parallel
Stars: ✭ 29 (-35.56%)
Mutual labels:  multipart
fetch-wrap
extend WHATWG fetch wrapping it with middlewares
Stars: ✭ 21 (-53.33%)
Mutual labels:  http-client
http-interceptors
The Web apps in this monorepo make HTTP requests and require uniform consistency in how they are executed and handled. This monorepo demonstrates the same app written with Angular and with Svelte. Each app uses HTTP interceptors. The Angular app uses HttpClient and its interceptors while the Svelte app uses Axios and its interceptors.
Stars: ✭ 46 (+2.22%)
Mutual labels:  http-client
ELWebService
A lightweight HTTP networking framework for Swift
Stars: ✭ 89 (+97.78%)
Mutual labels:  http-client

MultipartEncoder: A C++ implementation of encoding multipart/form-data

You may find the asynchronous http-client, i.e. cpprestsdk, does not support posting a multipart/form-data request. This MultipartEncoder is a work around to generate the body content of multipart/form-data format. So that then you can use a cpp HTTP-client, which is not limited to cpprestsdk, to post a multipart/form-data request by setting the encoded body content.

Build & Run

  1. Clone the MultipartEncoder repository

    # Make sure to clone with --recursive
    git clone --recursive https://github.com/AndsonYe/MultipartEncoder.git
  2. If not cloned with --recursive, you need to manually get the cpprestsdk submodle

    Ignore this step if you followed step 1 above.

    git submodule update --init --recursive
  3. Install dependencies required by cpprestsdk

    sudo apt-get install g++ git make zlib1g-dev libboost-all-dev libssl-dev cmake
  4. Build cpprestsdk. Suppose the directory you cloned MultipartEncoder into is MultipartEncoder_ROOT

    cd $MultipartEncoder_ROOT/cpprestsdk/Release
    mkdir build
    cd build
    cmake ..
    make -j$(nproc)
  5. Build MultipartEncoder sample

    cd $MultipartEncoder_ROOT
    make
  6. Run the sample

    ./run.sh

    The response is writtern in file $MultipartEncoder/results

Usage

MultipartParser parser;                             //Create parser instance;
parser.AddParameter(key, value);                    //Add text parameters using AddParameter
parser.AddFile(key, file_path);                     //Add file content using AddFile
std::string boundary = parser.boundary();           //Get the boundary generated by parser, each parser has its unique boundary, this boundary should be set in the HTTP request's header
std::string body = parser.GenBodyContent();         //Get the encoded multipart/form-data body content

Then you can use boundary and body in any HTTP clients.

Check the parser_test.cpp for complete example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].