Skip to content
This repository has been archived by the owner. It is now read-only.
The C++ library to work with multipart/form-data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake
lib/dmitigr
tests
.gitattributes
.gitignore Initial commit Feb 6, 2019
CMakeLists.txt
LICENSE.txt Initial commit Feb 6, 2019
README.md Moved to Cefeika Jul 19, 2019
TODO.md

README.md

THIS PROJECT IS A PART OF CEFEIKA PROJECT NOW!!!

The C++ library to work with multipart/form-data {#mainpage}

The implementation is aimed to be as simple as possible (maybe even "dumb") for better understanding and correctness.

ATTENTION, this software is "alpha" quality, use at your own risk!

Any feedback (especially results of testing) is highly appreciated!

Features

Straightforward and efficient parsing of a multipart/form-data body.

Example

std::string form_boundary(); // defined somewhere
std::string form_data(); // defined somewhere

void example()
{
  namespace mulf = dmitigr::mulf;
  auto data = mulf::Form_data::make(form_boundary(), form_data());
  std::cout << "Body parts count = " << data->body_parts_count() << "\n";
  // etc.
}

Download

The Dmitigr Mulf repository is located at Github here.

Installation and consuming

Dependencies

Build time settings

Settings that may be specified at build time by using CMake variables are:

  1. the type of the build (only meaningful to single-configuration generators);
  2. the flag to build the shared library (default is on);
  3. the flag to only install the header-only library (default is off);
  4. the flag to build the tests (default is on);
  5. installation directories.

Details:

CMake variable Possible values Default on Unix Default on Windows
The type of the build
CMAKE_BUILD_TYPE Debug | Release | RelWithDebInfo | MinSizeRel Debug Debug
The flag to build the shared library
BUILD_SHARED_LIBS On | Off On On
The flag to only install the header-only library
DMITIGR_MULF_HEADER_ONLY On | Off Off Off
The flag of building the tests
DMITIGR_MULF_BUILD_TESTS On | Off On On
Installation directories
CMAKE_INSTALL_PREFIX an absolute path "/usr/local" "%ProgramFiles%\dmitigr_mulf"
DMITIGR_MULF_CMAKE_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "share/dmitigr_mulf/cmake" "cmake"
DMITIGR_MULF_DOC_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "share/dmitigr_mulf/doc" "doc"
DMITIGR_MULF_LIB_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "lib" "lib"
DMITIGR_MULF_INCLUDE_INSTALL_DIR a path relative to CMAKE_INSTALL_PREFIX "include" "include"

Installation in common

Dmitigr Mulf is depends on dmitigr_common.

WARNING It's highly recommended to update the dmitigr_common library (just pull and reinstall) before every build of the Dmitigr Mulf library!

Installation on Linux

$ git clone https://github.com/dmitigr/mulf.git
$ mkdir -p mulf/build
$ cd mulf/build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ sudo make install

Installation on Microsoft Windows

Run the Developer Command Prompt for Visual Studio and type:

> git clone https://github.com/dmitigr/mulf.git
> mkdir mulf\build
> cd mulf\build
> cmake -G "Visual Studio 15 2017 Win64" ..
> cmake --build . --config Debug

Next, run the Elevated Command Prompt (i.e. the command prompt with administrator privileges) and type:

> cd mulf\build
> cmake -DBUILD_TYPE=Debug -P cmake_install.cmake

To make the installed DLL available for any application that depends on it, the symbolic link to the dmitigr_mulf.dll (or to the debug version - dmitigr_mulfd.dll) should be created:

  • in %SYSTEMROOT%\System32 for the 64-bit DLL on 64-bit host (or for 32-bit DLL on 32-bit host);
  • in %SYSTEMROOT%\SysWOW64 for the 32-bit DLL on 64-bit host.

To create the symbolic link run the Elevated Command Prompt and use mklink command, for example:

> cd /d %SYSTEMROOT%\System32
> mklink dmitigr_mulfd.dll "%ProgramFiles%\dmitigr_mulf\lib\dmitigr_mulfd.dll"

Consuming

If you are using CMake the consuming of the Dmitigr Mulf library is quite simple. For example:

cmake_minimum_required(VERSION 3.13)
project(foo)
find_package(dmitigr_mulf REQUIRED) # find shared version of the Dmitigr Mulf library
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
add_executable(foo foo.cpp)
target_link_libraries(foo dmitigr_mulf)

The above code snippet is minimal CMakeLists.txt that enough to build the application foo that depends on the Dmitigr Mulf library.

To consume the header-only version of the Dmitigr Mulf library just specify it by using CONFIGS option of find_package:

find_package(dmitigr_mulf REQUIRED CONFIGS dmitigr_mulf_interface-config.cmake)
# ...
target_link_libraries(foo dmitigr_mulf_interface)

License

Dmitigr Mulf is distributed under zlib license. For conditions of distribution and use, see file LICENSE.txt.

Donations

Dmitigr Mulf has been developed on the own funds. Donations are welcome! To make a donation, please go here.

Feedback

Any feedback are welcome. Contact us.

Copyright

Copyright (C) Dmitry Igrishin

You can’t perform that action at this time.