httpp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- httpp-0.1.0/.github/workflows/cmake.yml +103 -0
- httpp-0.1.0/.github/workflows/orchestrator.yml +88 -0
- httpp-0.1.0/.github/workflows/release_template.md +9 -0
- httpp-0.1.0/.github/workflows/wheels.yml +68 -0
- httpp-0.1.0/.gitignore +137 -0
- httpp-0.1.0/.gitmodules +6 -0
- httpp-0.1.0/CMakeLists.txt +107 -0
- httpp-0.1.0/LICENSE.txt +21 -0
- httpp-0.1.0/PKG-INFO +89 -0
- httpp-0.1.0/README.md +64 -0
- httpp-0.1.0/cmake/DynamicVersion.cmake +119 -0
- httpp-0.1.0/cmake/FindCython.cmake +113 -0
- httpp-0.1.0/cmake/Optimize.cmake +56 -0
- httpp-0.1.0/cmake/Startup.cmake +17 -0
- httpp-0.1.0/cmake/UseCython.cmake +251 -0
- httpp-0.1.0/cmake/httppConfig.cmake.in +8 -0
- httpp-0.1.0/docs/index.rst +19 -0
- httpp-0.1.0/examples/find_httpp_via_python/CMakeLists.txt +22 -0
- httpp-0.1.0/examples/find_httpp_via_python/main.cpp +8 -0
- httpp-0.1.0/include/httpp/client.hpp +44 -0
- httpp-0.1.0/include/httpp/download.hpp +47 -0
- httpp-0.1.0/include/httpp/export.hpp +15 -0
- httpp-0.1.0/include/httpp/progress.hpp +81 -0
- httpp-0.1.0/include/httpp/server.hpp +50 -0
- httpp-0.1.0/include/httpp/url.hpp +34 -0
- httpp-0.1.0/include/httpp.h +55 -0
- httpp-0.1.0/pyproject.toml +88 -0
- httpp-0.1.0/requirements-dev.txt +12 -0
- httpp-0.1.0/src/bindings/python/CMakeLists.txt +129 -0
- httpp-0.1.0/src/bindings/python/httpp/__init__.py +43 -0
- httpp-0.1.0/src/bindings/python/httpp/__main__.py +145 -0
- httpp-0.1.0/src/bindings/python/httpp_cy.pyx +193 -0
- httpp-0.1.0/src/core/client.cpp +57 -0
- httpp-0.1.0/src/core/download.cpp +101 -0
- httpp-0.1.0/src/core/progress.cpp +57 -0
- httpp-0.1.0/src/core/server.cpp +60 -0
- httpp-0.1.0/src/core/url.cpp +45 -0
- httpp-0.1.0/src/third_party/README.md +24 -0
- httpp-0.1.0/src/third_party/cpp-httplib/httplib.h +22669 -0
- httpp-0.1.0/src/third_party/indicators/indicators.hpp +3249 -0
- httpp-0.1.0/tests/CMakeLists.txt +13 -0
- httpp-0.1.0/tests/cmake/CMakeLists.txt +22 -0
- httpp-0.1.0/tests/cmake/consumer_project/CMakeLists.txt +22 -0
- httpp-0.1.0/tests/cmake/consumer_project/main.cpp +8 -0
- httpp-0.1.0/tests/cmake/run_consumer_test.cmake +54 -0
- httpp-0.1.0/tests/cpp/CMakeLists.txt +27 -0
- httpp-0.1.0/tests/cpp/test_client.cpp +67 -0
- httpp-0.1.0/tests/cpp/test_download.cpp +120 -0
- httpp-0.1.0/tests/cpp/test_progress.cpp +43 -0
- httpp-0.1.0/tests/cpp/test_server.cpp +74 -0
- httpp-0.1.0/tests/cpp/test_url.cpp +37 -0
- httpp-0.1.0/tests/python/CMakeLists.txt +28 -0
- httpp-0.1.0/tests/python/test_httpp_basic.py +63 -0
- httpp-0.1.0/tests/utest/utest.h +1305 -0
- httpp-0.1.0/tests/utest/utest_main.cxx +3 -0
- httpp-0.1.0/version.py +252 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: cmake stuff
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-test:
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
14
|
+
|
|
15
|
+
runs-on: ${{ matrix.os }}
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@v6
|
|
20
|
+
with:
|
|
21
|
+
submodules: true
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v6
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.11"
|
|
27
|
+
cache: "pip"
|
|
28
|
+
|
|
29
|
+
- name: Install python deps
|
|
30
|
+
run: pip install -r requirements-dev.txt
|
|
31
|
+
|
|
32
|
+
- name: Configure Project
|
|
33
|
+
uses: threeal/cmake-action@v2.1.0
|
|
34
|
+
with:
|
|
35
|
+
build-dir: build
|
|
36
|
+
run-build: false
|
|
37
|
+
options: |
|
|
38
|
+
CMAKE_BUILD_TYPE=Release
|
|
39
|
+
HTTPP_BUILD_TESTS=ON
|
|
40
|
+
HTTPP_BUILD_PYTHON=ON
|
|
41
|
+
|
|
42
|
+
- name: Build
|
|
43
|
+
run: cmake --build build -j4 --config Release
|
|
44
|
+
|
|
45
|
+
- name: Run tests (Linux/macOS)
|
|
46
|
+
if: runner.os != 'Windows'
|
|
47
|
+
run: ctest --test-dir build --output-on-failure --extra-verbose
|
|
48
|
+
|
|
49
|
+
build-coverage:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- name: Checkout repository
|
|
54
|
+
uses: actions/checkout@v6
|
|
55
|
+
with:
|
|
56
|
+
submodules: true
|
|
57
|
+
|
|
58
|
+
- name: Setup cmake
|
|
59
|
+
uses: jwlawson/actions-setup-cmake@v2
|
|
60
|
+
with:
|
|
61
|
+
cmake-version: '3.28.x'
|
|
62
|
+
|
|
63
|
+
- name: Set up Python
|
|
64
|
+
uses: actions/setup-python@v6
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.11"
|
|
67
|
+
cache: "pip"
|
|
68
|
+
|
|
69
|
+
- name: Install python dependencies
|
|
70
|
+
run: pip install -r requirements-dev.txt
|
|
71
|
+
|
|
72
|
+
- name: Install coverage tools
|
|
73
|
+
run: |
|
|
74
|
+
sudo apt-get update
|
|
75
|
+
sudo apt-get install -y lcov
|
|
76
|
+
|
|
77
|
+
- name: Configure CMake with coverage
|
|
78
|
+
run: |
|
|
79
|
+
cmake -B build \
|
|
80
|
+
-DHTTPP_BUILD_TESTS=ON \
|
|
81
|
+
-DHTTPP_BUILD_PYTHON=ON \
|
|
82
|
+
-DCMAKE_CXX_FLAGS="--coverage -O0 -g" \
|
|
83
|
+
-DCMAKE_EXE_LINKER_FLAGS="--coverage"
|
|
84
|
+
|
|
85
|
+
- name: Build and run C++ tests
|
|
86
|
+
run: |
|
|
87
|
+
cmake --build build --target test_httpp_cpp -j4
|
|
88
|
+
ctest --test-dir build -R test_httpp_cpp --output-on-failure
|
|
89
|
+
|
|
90
|
+
- name: Capture coverage
|
|
91
|
+
run: |
|
|
92
|
+
lcov --capture --directory build --base-directory . \
|
|
93
|
+
--exclude '*/tests/*' --exclude '*/third_party/*' --exclude '/usr/*' \
|
|
94
|
+
--output-file coverage.lcov
|
|
95
|
+
|
|
96
|
+
- name: Upload coverage to Codecov
|
|
97
|
+
uses: codecov/codecov-action@v5
|
|
98
|
+
with:
|
|
99
|
+
files: coverage.lcov
|
|
100
|
+
flags: unittests
|
|
101
|
+
name: codecov-httpp
|
|
102
|
+
fail_ci_if_error: false
|
|
103
|
+
verbose: true
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Orchestration & Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: [ master ]
|
|
7
|
+
tags: [ "v*" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
init:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
outputs:
|
|
13
|
+
release_name: ${{ steps.init.outputs.release_name }}
|
|
14
|
+
is_tag: ${{ steps.init.outputs.is_tag }}
|
|
15
|
+
version_string: ${{ steps.init.outputs.version_string }}
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v6
|
|
19
|
+
|
|
20
|
+
- name: Initalize
|
|
21
|
+
id: init
|
|
22
|
+
env:
|
|
23
|
+
GH_TOKEN: ${{ github.token }}
|
|
24
|
+
run: |
|
|
25
|
+
export version_string="$(python version.py | tr -d '\n')"
|
|
26
|
+
echo "version_string=${version_string}" | tee -a "$GITHUB_OUTPUT"
|
|
27
|
+
if [[ "${{ github.ref }}" =~ ^refs/tags/v.*$ ]]; then
|
|
28
|
+
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
|
29
|
+
[[ "${version_string}" == "${GITHUB_REF#refs/tags/v}" ]] || (echo "❌ Version mismatch!" && exit 1)
|
|
30
|
+
export release_name="$TAG_NAME"
|
|
31
|
+
export is_tag="true"
|
|
32
|
+
else
|
|
33
|
+
gh api repos/${{ github.repository }}/releases/tags/__beta__ --jq '.assets[].id' 2>/dev/null | xargs -r -I {} gh api repos/${{ github.repository }}/releases/assets/{} -X DELETE 2>/dev/null || true
|
|
34
|
+
export release_name="__beta__"
|
|
35
|
+
export is_tag="false"
|
|
36
|
+
fi
|
|
37
|
+
echo "release_name=${release_name}" | tee -a "$GITHUB_OUTPUT"
|
|
38
|
+
echo "is_tag=${is_tag}" | tee -a "$GITHUB_OUTPUT"
|
|
39
|
+
sed -i -e "s/RELEASE_NAME/${release_name}/g" -e "s/VERSION_STRING/${version_string}/g" .github/workflows/release_template.md
|
|
40
|
+
|
|
41
|
+
- name: Initialize release body
|
|
42
|
+
uses: softprops/action-gh-release@v3
|
|
43
|
+
with:
|
|
44
|
+
tag_name: ${{ steps.init.outputs.release_name }}
|
|
45
|
+
name: ${{ steps.init.outputs.release_name }}
|
|
46
|
+
draft: false
|
|
47
|
+
prerelease: ${{ steps.init.outputs.is_tag == 'false' }}
|
|
48
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
49
|
+
body_path: .github/workflows/release_template.md
|
|
50
|
+
|
|
51
|
+
cmake:
|
|
52
|
+
uses: ./.github/workflows/cmake.yml
|
|
53
|
+
needs: [init]
|
|
54
|
+
|
|
55
|
+
wheel:
|
|
56
|
+
uses: ./.github/workflows/wheels.yml
|
|
57
|
+
needs: [init]
|
|
58
|
+
|
|
59
|
+
release-wheels:
|
|
60
|
+
needs: [wheel, init]
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- name: Download all artifacts
|
|
64
|
+
uses: actions/download-artifact@v8
|
|
65
|
+
with:
|
|
66
|
+
pattern: wheelhouse-*
|
|
67
|
+
path: dist
|
|
68
|
+
merge-multiple: true
|
|
69
|
+
|
|
70
|
+
- name: List dist directory
|
|
71
|
+
run: tree --du -shaC .
|
|
72
|
+
|
|
73
|
+
- name: create release body
|
|
74
|
+
uses: softprops/action-gh-release@v3
|
|
75
|
+
with:
|
|
76
|
+
tag_name: ${{ needs.init.outputs.release_name }}
|
|
77
|
+
name: ${{ needs.init.outputs.release_name }}
|
|
78
|
+
draft: false
|
|
79
|
+
prerelease: ${{ needs.init.outputs.is_tag == 'false' }}
|
|
80
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
81
|
+
files: dist/*
|
|
82
|
+
|
|
83
|
+
- name: Publishing to PyPi
|
|
84
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
85
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
86
|
+
with:
|
|
87
|
+
password: ${{ secrets.PYPI_PASSWORD }}
|
|
88
|
+
user: ${{ secrets.PYPI_USERNAME }}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
| OS | Available Wheels & Source |
|
|
3
|
+
| :--- | :--- |
|
|
4
|
+
| **Windows** | [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314t-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp313-cp313-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp312-cp312-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp311-cp311-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp310-cp310-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp39-cp39-win_amd64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314t-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp313-cp313-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp312-cp312-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp311-cp311-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp310-cp310-win32.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp39-cp39-win32.whl) |
|
|
5
|
+
| **Linux (glibc)** | [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl) |
|
|
6
|
+
| **Linux (musl)** | [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314t-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp313-cp313-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp312-cp312-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp311-cp311-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp310-cp310-musllinux_1_2_x86_64.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp39-cp39-musllinux_1_2_x86_64.whl) |
|
|
7
|
+
| **macOS** | [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314-macosx_10_15_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp314-cp314t-macosx_10_15_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp313-cp313-macosx_10_13_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp312-cp312-macosx_10_13_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp311-cp311-macosx_10_13_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp310-cp310-macosx_10_13_universal2.whl) [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING-cp39-cp39-macosx_10_13_universal2.whl) |
|
|
8
|
+
| **Source** | [](https://github.com/MohammadRaziei/httpp/releases/download/RELEASE_NAME/httpp-VERSION_STRING.tar.gz) [](https://github.com/MohammadRaziei/httpp/archive/refs/tags/RELEASE_NAME.zip) [](https://github.com/MohammadRaziei/httpp/archive/refs/tags/RELEASE_NAME.tar.gz) |
|
|
9
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: python build wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
FORCE_COLOR: 3
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: wheels-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build_sdist:
|
|
18
|
+
name: Build SDist
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
with:
|
|
23
|
+
submodules: false
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v6
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.11"
|
|
28
|
+
cache: "pip"
|
|
29
|
+
|
|
30
|
+
- name: Build SDist
|
|
31
|
+
run: pipx run build --sdist
|
|
32
|
+
|
|
33
|
+
- name: Check metadata
|
|
34
|
+
run: pipx run twine check dist/*
|
|
35
|
+
|
|
36
|
+
- uses: actions/upload-artifact@v7
|
|
37
|
+
with:
|
|
38
|
+
name: wheelhouse-sdist
|
|
39
|
+
path: dist/*.tar.gz
|
|
40
|
+
overwrite: true
|
|
41
|
+
|
|
42
|
+
build_wheels:
|
|
43
|
+
name: Wheels on ${{ matrix.os }}
|
|
44
|
+
runs-on: ${{ matrix.os }}
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: true
|
|
47
|
+
matrix:
|
|
48
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v6
|
|
52
|
+
with:
|
|
53
|
+
submodules: true
|
|
54
|
+
|
|
55
|
+
- name: Build wheels
|
|
56
|
+
uses: pypa/cibuildwheel@v3.4.1
|
|
57
|
+
env:
|
|
58
|
+
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
59
|
+
CIBW_ARCHS_MACOS: universal2
|
|
60
|
+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
|
|
61
|
+
CIBW_ENVIRONMENT_CP312: "SKBUILD_WHEEL_PY_API=cp312"
|
|
62
|
+
CIBW_SKIP: pp*
|
|
63
|
+
|
|
64
|
+
- uses: actions/upload-artifact@v7
|
|
65
|
+
with:
|
|
66
|
+
name: wheelhouse-${{ matrix.os }}
|
|
67
|
+
path: wheelhouse/*.whl
|
|
68
|
+
overwrite: false
|
httpp-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
db.sqlite3
|
|
57
|
+
db.sqlite3-journal
|
|
58
|
+
|
|
59
|
+
# Flask stuff:
|
|
60
|
+
instance/
|
|
61
|
+
.webassets-cache
|
|
62
|
+
|
|
63
|
+
# Scrapy stuff:
|
|
64
|
+
.scrapy
|
|
65
|
+
|
|
66
|
+
# Sphinx documentation docs/
|
|
67
|
+
docs/_build/
|
|
68
|
+
|
|
69
|
+
# PyBuilder
|
|
70
|
+
.pybuilder/
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# IPython
|
|
77
|
+
profile_default/
|
|
78
|
+
ipython_config.py
|
|
79
|
+
|
|
80
|
+
# pyenv
|
|
81
|
+
.python-version
|
|
82
|
+
|
|
83
|
+
# pipenv
|
|
84
|
+
Pipfile.lock
|
|
85
|
+
|
|
86
|
+
# PEP 582
|
|
87
|
+
__pypackages__/
|
|
88
|
+
|
|
89
|
+
# Celery stuff
|
|
90
|
+
celerybeat-schedule
|
|
91
|
+
celerybeat.pid
|
|
92
|
+
|
|
93
|
+
# SageMath parsed template
|
|
94
|
+
*.sage.py
|
|
95
|
+
|
|
96
|
+
# Environments
|
|
97
|
+
.env
|
|
98
|
+
.venv
|
|
99
|
+
env/
|
|
100
|
+
venv/
|
|
101
|
+
ENV/
|
|
102
|
+
env.bak/
|
|
103
|
+
venv.bak/
|
|
104
|
+
|
|
105
|
+
# Spyder project settings
|
|
106
|
+
.spyderproject
|
|
107
|
+
.spyproject
|
|
108
|
+
|
|
109
|
+
# Rope project settings
|
|
110
|
+
.ropeproject
|
|
111
|
+
|
|
112
|
+
# mkdocs documentation
|
|
113
|
+
/site
|
|
114
|
+
|
|
115
|
+
# mypy
|
|
116
|
+
.mypy_cache/
|
|
117
|
+
.dmypy.json
|
|
118
|
+
dmypy.json
|
|
119
|
+
|
|
120
|
+
# Pyre type checker
|
|
121
|
+
.pyre/
|
|
122
|
+
|
|
123
|
+
# IDEs
|
|
124
|
+
.vscode/
|
|
125
|
+
.idea/
|
|
126
|
+
|
|
127
|
+
# OS generated files
|
|
128
|
+
.DS_Store
|
|
129
|
+
.DS_Store?
|
|
130
|
+
._*
|
|
131
|
+
.Spotlight-V100
|
|
132
|
+
.Trashes
|
|
133
|
+
ehthumbs.db
|
|
134
|
+
Thumbs.db
|
|
135
|
+
|
|
136
|
+
# Build directory
|
|
137
|
+
build/
|
httpp-0.1.0/.gitmodules
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.21)
|
|
2
|
+
|
|
3
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
|
4
|
+
include(DynamicVersion)
|
|
5
|
+
|
|
6
|
+
extract_version_string(
|
|
7
|
+
HEADER_FILE ${CMAKE_CURRENT_LIST_DIR}/include/httpp.h
|
|
8
|
+
VERSION_PREFIX HTTPP_
|
|
9
|
+
OUTPUT_VAR PROJECT_VERSION
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
project(httpp LANGUAGES CXX VERSION ${PROJECT_VERSION})
|
|
13
|
+
message(STATUS "Project: ${PROJECT_NAME}@v${PROJECT_VERSION}")
|
|
14
|
+
include(Startup)
|
|
15
|
+
|
|
16
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
17
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
18
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
19
|
+
|
|
20
|
+
include(Optimize)
|
|
21
|
+
|
|
22
|
+
# Project options
|
|
23
|
+
option(HTTPP_BUILD_TESTS "Build tests" ${PROJECT_IS_TOP_LEVEL})
|
|
24
|
+
option(HTTPP_BUILD_PYTHON "Build Python bindings" ${PROJECT_IS_TOP_LEVEL})
|
|
25
|
+
|
|
26
|
+
set(HTTPP_SOURCE_DIR ${PROJECT_SOURCE_DIR})
|
|
27
|
+
|
|
28
|
+
# --- httpp C++ core ---
|
|
29
|
+
# httplib.h is vendored at src/third_party/cpp-httplib (a real committed
|
|
30
|
+
# file, no system package). mbedtls is a git submodule at
|
|
31
|
+
# src/third_party/mbedtls (also built from source, no system package).
|
|
32
|
+
# Both are included only from src/core/*.cpp, never from a public
|
|
33
|
+
# include/httpp/*.hpp header, and are compiled with hidden visibility so
|
|
34
|
+
# they never leak into the httpp .so/.a's public symbols.
|
|
35
|
+
file(GLOB HTTPP_CORE_SOURCES ${PROJECT_SOURCE_DIR}/src/core/*.cpp)
|
|
36
|
+
|
|
37
|
+
# liburlparser (git submodule, built from source — no system package) does
|
|
38
|
+
# the real URL parsing (scheme/host/port/path, IPv4/IPv6, PSL-aware). It is
|
|
39
|
+
# linked PRIVATE into httpp_core, same as cpp-httplib: consumers of
|
|
40
|
+
# <httpp/url.hpp> see only httpp::url, never urlparser::url directly.
|
|
41
|
+
set(BUILD_PYTHON OFF CACHE BOOL "" FORCE)
|
|
42
|
+
# Needed so liburlparser's static lib can be linked into httpp's shared
|
|
43
|
+
# lib / the Cython extension module (which are themselves PIC).
|
|
44
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
45
|
+
add_subdirectory(${PROJECT_SOURCE_DIR}/src/third_party/liburlparser)
|
|
46
|
+
|
|
47
|
+
add_library(httpp_core SHARED ${HTTPP_CORE_SOURCES})
|
|
48
|
+
add_library(httpp::core ALIAS httpp_core)
|
|
49
|
+
|
|
50
|
+
# Windows/MSVC dllexport-vs-dllimport: HTTPP_API (include/httpp/export.hpp)
|
|
51
|
+
# resolves to __declspec(dllexport) only when HTTPP_BUILDING_DLL is defined.
|
|
52
|
+
# It must be defined while compiling httpp_core's OWN translation units
|
|
53
|
+
# (client.cpp/server.cpp/url.cpp) so the public classes are actually
|
|
54
|
+
# exported from httpp_core.dll — and must NOT be defined for anyone
|
|
55
|
+
# consuming the already-built DLL (they need dllimport instead), hence
|
|
56
|
+
# PRIVATE, not PUBLIC/INTERFACE.
|
|
57
|
+
target_compile_definitions(httpp_core PRIVATE HTTPP_BUILDING_DLL)
|
|
58
|
+
|
|
59
|
+
set_target_properties(httpp_core PROPERTIES
|
|
60
|
+
POSITION_INDEPENDENT_CODE ON
|
|
61
|
+
CXX_VISIBILITY_PRESET hidden
|
|
62
|
+
VISIBILITY_INLINES_HIDDEN ON
|
|
63
|
+
MACOSX_RPATH ON
|
|
64
|
+
INSTALL_NAME_DIR "@rpath"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
target_include_directories(httpp_core
|
|
68
|
+
PUBLIC
|
|
69
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
70
|
+
$<INSTALL_INTERFACE:httpp/include>
|
|
71
|
+
PRIVATE
|
|
72
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src/third_party/cpp-httplib
|
|
73
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src/third_party
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
find_package(Threads REQUIRED)
|
|
77
|
+
target_link_libraries(httpp_core PUBLIC Threads::Threads)
|
|
78
|
+
target_link_libraries(httpp_core PRIVATE url::base)
|
|
79
|
+
|
|
80
|
+
target_compile_options(httpp_core PRIVATE
|
|
81
|
+
$<$<CXX_COMPILER_ID:MSVC>:/W4 /EHsc>
|
|
82
|
+
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic>
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
apply_optimization_flags(httpp_core)
|
|
86
|
+
|
|
87
|
+
if(HTTPP_BUILD_PYTHON OR DEFINED SKBUILD)
|
|
88
|
+
set(PYTHON_INSTALL_DIR ${CMAKE_BINARY_DIR}/python/install)
|
|
89
|
+
add_subdirectory(${PROJECT_SOURCE_DIR}/src/bindings/python)
|
|
90
|
+
if(DEFINED SKBUILD)
|
|
91
|
+
return()
|
|
92
|
+
endif()
|
|
93
|
+
endif()
|
|
94
|
+
|
|
95
|
+
# Installation
|
|
96
|
+
install(TARGETS httpp_core
|
|
97
|
+
ARCHIVE DESTINATION lib
|
|
98
|
+
LIBRARY DESTINATION lib
|
|
99
|
+
)
|
|
100
|
+
install(DIRECTORY include DESTINATION .)
|
|
101
|
+
|
|
102
|
+
# Tests
|
|
103
|
+
if(HTTPP_BUILD_TESTS)
|
|
104
|
+
enable_testing()
|
|
105
|
+
set(CMAKE_CTEST_ARGUMENTS "--output-on-failure" "-V")
|
|
106
|
+
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
|
|
107
|
+
endif()
|
httpp-0.1.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Mohammad Raziei
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
httpp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: httpp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Cython project with scikit-build
|
|
5
|
+
Author-Email: Mohammad Raziei <mohammadraziei1375@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Project-URL: Homepage, https://github.com/MohammadRaziei/httpp
|
|
17
|
+
Project-URL: Bug Tracker, https://github.com/MohammadRaziei/httpp/issues
|
|
18
|
+
Project-URL: Document, https://MohammadRaziei.github.io/httpp
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-xdist>=3.0; extra == "test"
|
|
23
|
+
Requires-Dist: pytest-cov>=4.0; extra == "test"
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# httpp
|
|
27
|
+
|
|
28
|
+
A lightweight HTTP client + server library for C++ and Python — install
|
|
29
|
+
with `pip`, no system dependencies (no `apt`/`choco`/`brew` required), works
|
|
30
|
+
as both a Python package and a C++ library via CMake.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install httpp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
**Python**
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from httpp import Client, Server
|
|
44
|
+
|
|
45
|
+
# client
|
|
46
|
+
res = Client.fetch("http://example.com/")
|
|
47
|
+
print(res.status, res.body)
|
|
48
|
+
|
|
49
|
+
# server — like `python -m http.server`, but embeddable in your own app
|
|
50
|
+
srv = Server()
|
|
51
|
+
srv.serve_directory("/", "./public")
|
|
52
|
+
srv.listen("0.0.0.0", 8000)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**CLI**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
httpp server . # serve the current directory, like python -m http.server
|
|
59
|
+
httpp download http://example.com/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**C++**
|
|
63
|
+
|
|
64
|
+
```cpp
|
|
65
|
+
#include <httpp.h>
|
|
66
|
+
|
|
67
|
+
auto res = httpp::client::fetch("http://example.com/");
|
|
68
|
+
|
|
69
|
+
httpp::server srv;
|
|
70
|
+
srv.serve_directory("/", "./public");
|
|
71
|
+
srv.listen("0.0.0.0", 8000);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```cmake
|
|
75
|
+
find_package(httpp CONFIG REQUIRED)
|
|
76
|
+
target_link_libraries(app PRIVATE httpp::httpp)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Status
|
|
80
|
+
|
|
81
|
+
- [x] Client — GET requests, `Client.fetch(url)` from a full URL
|
|
82
|
+
- [x] Server — route handlers, static directory serving
|
|
83
|
+
- [x] CLI — `httpp server`, `httpp download`
|
|
84
|
+
- [ ] HTTPS
|
|
85
|
+
- [ ] Route handlers from Python (directory serving works today)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|