Skip to content

Commit b432988

Browse files
committed
FIX | workflow
1 parent 1c2d657 commit b432988

10 files changed

Lines changed: 99 additions & 100 deletions

File tree

.github/workflows/conan_build_and_test.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ jobs:
3838
uses: actions/setup-python@v4
3939
with:
4040
python-version: "3.11"
41-
42-
- name: switch to gcc-14 on linux
43-
if: ${{ matrix.os == 'ubuntu-latest' }}
44-
run: |
45-
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
46-
sudo apt update
47-
sudo apt install g++-14 gcc-14
48-
echo "CXX=g++-14" >> $GITHUB_ENV
49-
echo "CC=gcc-14" >> $GITHUB_ENV
5041

5142
- name: Install Conan
5243
run: pip install conan==2.*
@@ -89,13 +80,13 @@ jobs:
8980
run: conan cache clean "*/*"
9081

9182
- name: Configure CMake
92-
run: cmake --preset conan-release -DMANAPIHTTP_DISABLE_TRACE_HARD=ON -DMANAPIHTTP_STD_BACKTRACE_DEPENDENCY=OFF
83+
run: cmake --preset conan-release -DMANAPIHTTP_ENABLE_TESTS=ON -DMANAPIHTTP_DISABLE_TRACE_HARD=ON -DMANAPIHTTP_STD_BACKTRACE_DEPENDENCY=OFF
9384

9485
- name: Build
9586
run: cmake --build build/Release
9687

9788
- name: Run unit tests
9889
run: ctest --output-on-failure -C Release
99-
working-directory: build
90+
working-directory: build/Release
10091

10192

handlers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ void init_http_server(manapi::net::http::server &router, std::string const &fold
99
router.GET("/", folder, [] (http::req &req, http::resp &resp)
1010
-> manapi::future<> {
1111
resp.compress_enabled(true);
12-
req.url()
1312
resp.compress("zstd");
1413
co_return;
1514
});

include/http/ManapiHttpResponse.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ namespace manapi::net::http {
3232
using resp_callback_async = std::move_only_function<manapi::future<ssize_t>(slice_view buffs, bool&)>;
3333
using resp_stream_cb = std::move_only_function<manapi::future<ssize_t>(manapi::slice_view buffs, bool)>;
3434
using resp_stream = std::move_only_function<manapi::future<>(resp_stream_cb cb)>;
35+
#ifdef MANAPIHTTP_FETCH_SUPPORT
3536
using resp_proxy_setup_cb = std::move_only_function<void(class manapi::net::fetch &)>;
37+
#endif
3638

3739
response (internal::handle_data_t* cdata, uint16_t status, http::config *config, std::unique_ptr<http::request> req);
3840

src/ManapiEventLoop.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ manapi::sys_error::status_or<std::shared_ptr<manapi::event_loop>> manapi::event_
679679
try {
680680
ev->loop_ = std::make_unique<uv_loop_t>();
681681

682-
#ifdef MANAPIHTTP_CURL_DEPENDENCY
682+
#if MANAPIHTTP_CURL_DEPENDENCY
683683
ev->curl_watcher = std::make_unique<ev::internal::curl_watcher_t>();
684684
#endif
685685

@@ -804,11 +804,11 @@ manapi::sys_error::status_or<std::shared_ptr<manapi::event_loop>> manapi::event_
804804
if (ev->callback_watcher_) {
805805
ev->stop_watcher(std::move(ev->callback_watcher_->adding_async));
806806
}
807-
807+
#if MANAPIHTTP_CURL_DEPENDENCY
808808
if (ev->curl_watcher) {
809809
ev->stop_watcher(std::move(ev->curl_watcher->timeout_watcher));
810810
}
811-
811+
#endif
812812
ev->stop_watcher(std::move(ev->interrupted_watcher_));
813813
ev->stop_watcher(std::move(ev->prepare_tasks_));
814814
ev->stop_watcher(std::move(ev->idle_tasks_));
@@ -889,8 +889,9 @@ void manapi::event_loop::wait() {
889889
this->stop_watcher(std::move(this->callback_watcher_->adding_async));
890890
this->stop_watcher(std::move(this->idle_tasks_));
891891
this->stop_watcher(std::move(this->prepare_tasks_));
892+
#if MANAPIHTTP_CURL_DEPENDENCY
892893
this->stop_watcher(std::move(this->curl_watcher->timeout_watcher));
893-
894+
#endif
894895
std::shared_ptr<ev::idle> idle_tasks;
895896

896897
if (this->loop_) {
@@ -1139,6 +1140,21 @@ manapi::error::status manapi::event_loop::custom_callback(std::move_only_functio
11391140
return this->custom_callback(&cb);
11401141
}
11411142

1143+
manapi::error::status manapi::event_loop::custom_callback(std::move_only_function<void(event_loop *ev)> *cb) MANAPIHTTP_NOEXCEPT {
1144+
try {
1145+
std::unique_lock<std::mutex> lk (this->callback_watcher_->adding_mx);
1146+
this->callback_watcher_->callback_data.push_back({nullptr});
1147+
this->callback_watcher_->callback_data.back().cb = std::move(*cb);
1148+
lk.unlock();
1149+
this->callback_watcher_->adding_async_cb();
1150+
return error::status_ok();
1151+
}
1152+
catch (std::exception const &e) {
1153+
manapi_log_error("%s due to %s", "custom_callback:Failed",e.what());
1154+
return error::status_internal("custom_callback:Failed");
1155+
}
1156+
}
1157+
11421158
#if MANAPIHTTP_CURL_DEPENDENCY
11431159
void manapi::event_loop::handle_curl_exec_connections() {
11441160
int running_handles = 0;
@@ -1420,21 +1436,6 @@ manapi::error::status manapi::event_loop::pause_watch_curl(void * shared_curl) M
14201436
return error::status_ok();
14211437
}
14221438

1423-
manapi::error::status manapi::event_loop::custom_callback(std::move_only_function<void(event_loop *ev)> *cb) MANAPIHTTP_NOEXCEPT {
1424-
try {
1425-
std::unique_lock<std::mutex> lk (this->callback_watcher_->adding_mx);
1426-
this->callback_watcher_->callback_data.push_back({nullptr});
1427-
this->callback_watcher_->callback_data.back().cb = std::move(*cb);
1428-
lk.unlock();
1429-
this->callback_watcher_->adding_async_cb();
1430-
return error::status_ok();
1431-
}
1432-
catch (std::exception const &e) {
1433-
manapi_log_error("%s due to %s", "custom_callback:Failed",e.what());
1434-
return error::status_internal("custom_callback:Failed");
1435-
}
1436-
}
1437-
14381439
manapi::error::status manapi::event_loop::unpause_watch_curl(void *shared_curl) MANAPIHTTP_NOEXCEPT {
14391440
auto &curl = *static_cast<std::shared_ptr<CURL> *> (shared_curl);
14401441
/* unpause */

src/ManapiHttp.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212

1313
#include "ManapiHttp.hpp"
1414
#include "std/ManapiAsyncPromise.hpp"
15-
15+
#include "fs/ManapiFilesystem.hpp"
1616
#include "./include/ManapiSiteInternal.hpp"
1717
#include "./include/ManapiUtils.hpp"
18-
#include "./include/ManapiUtils.hpp"
1918

2019
manapi::net::http::server::~server() = default;
2120

src/compress/ManapiCompress.cpp

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,39 @@
88

99
#define CHUNK_SIZE 65536
1010

11-
#ifdef MANAPIHTTP_BROTLI_DEPENDENCY
11+
12+
static manapi::future<manapi::error::status> compress_file_init (manapi::filesystem::fstream &input, manapi::filesystem::fstream &output, std::string src, std::string dest, manapi::async::cancellation_action &cancellation) {
13+
auto ires = manapi::filesystem::fstream::create (std::move(src), manapi::async::cancellation_action::unit(cancellation));
14+
auto ores = manapi::filesystem::fstream::create (std::move(dest), manapi::async::cancellation_action::unit(cancellation));
15+
16+
if (!ires)
17+
co_return ires.err();
18+
19+
if (!ores)
20+
co_return ores.err();
21+
22+
input = ires.unwrap();
23+
output = ores.unwrap();
24+
25+
auto oires = co_await input.open(manapi::ev::FS_O_RDONLY);
26+
if (!oires) {
27+
manapi_log_trace(manapi::debug::LOG_TRACE_MEDIUM, "%s failed due to %.*s",
28+
"compress:input open", oires.sysmsg().size(), oires.sysmsg().data());
29+
co_return std::move(oires);
30+
}
31+
auto oores = co_await output.open(manapi::ev::FS_O_CREAT|manapi::ev::FS_O_TRUNC|manapi::ev::FS_O_WRONLY,
32+
manapi::ev::IRUSR|manapi::ev::IWUSR|manapi::ev::IRGRP);
33+
if (!oores) {
34+
manapi_log_trace(manapi::debug::LOG_TRACE_MEDIUM, "%s failed due to %.*s",
35+
"compress:output open", oores.sysmsg().size(), oores.sysmsg().data());
36+
co_return std::move(oores);
37+
}
38+
39+
co_return manapi::error::status_ok();
40+
}
41+
42+
43+
#if MANAPIHTTP_BROTLI_DEPENDENCY
1244

1345
# include <brotli/encode.h>
1446
# include <brotli/decode.h>
@@ -53,36 +85,6 @@ manapi::error::status_or<std::string> manapi::compress::brotli_compress_string(s
5385
return error::status_internal("brotli: compress failed");
5486
}
5587

56-
static manapi::future<manapi::error::status> compress_file_init (manapi::filesystem::fstream &input, manapi::filesystem::fstream &output, std::string src, std::string dest, manapi::async::cancellation_action &cancellation) {
57-
auto ires = manapi::filesystem::fstream::create (std::move(src), manapi::async::cancellation_action::unit(cancellation));
58-
auto ores = manapi::filesystem::fstream::create (std::move(dest), manapi::async::cancellation_action::unit(cancellation));
59-
60-
if (!ires)
61-
co_return ires.err();
62-
63-
if (!ores)
64-
co_return ores.err();
65-
66-
input = ires.unwrap();
67-
output = ores.unwrap();
68-
69-
auto oires = co_await input.open(manapi::ev::FS_O_RDONLY);
70-
if (!oires) {
71-
manapi_log_trace(manapi::debug::LOG_TRACE_MEDIUM, "%s failed due to %.*s",
72-
"compress:input open", oires.sysmsg().size(), oires.sysmsg().data());
73-
co_return std::move(oires);
74-
}
75-
auto oores = co_await output.open(manapi::ev::FS_O_CREAT|manapi::ev::FS_O_TRUNC|manapi::ev::FS_O_WRONLY,
76-
manapi::ev::IRUSR|manapi::ev::IWUSR|manapi::ev::IRGRP);
77-
if (!oores) {
78-
manapi_log_trace(manapi::debug::LOG_TRACE_MEDIUM, "%s failed due to %.*s",
79-
"compress:output open", oores.sysmsg().size(), oores.sysmsg().data());
80-
co_return std::move(oores);
81-
}
82-
83-
co_return manapi::error::status_ok();
84-
}
85-
8688
manapi::future<manapi::error::status> manapi::compress::brotli_compress_file(std::string src, std::string dest, int quality, int window, int mode, manapi::async::cancellation_action cancellation) {
8789
manapi::filesystem::fstream input, output;
8890

@@ -189,7 +191,7 @@ manapi::future<manapi::error::status> manapi::compress::brotli_decompress_file(s
189191

190192
#endif
191193

192-
#ifdef MANAPIHTTP_ZSTD_DEPENDENCY
194+
#if MANAPIHTTP_ZSTD_DEPENDENCY
193195

194196
# include <zstd.h>
195197

src/http/ManapiBaseHttp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222

2323
static const std::set<std::string> methods = {"POST", "GET", "HEAD", "OPTIONS", "TRACE", "PUT", "DELETE", "PATCH", "CONNECT"};
2424

25+
#ifdef MANAPIHTTP_FETCH_SUPPORT
2526
struct response_proxy_data_t {
2627
ssize_t content_length;
2728
manapi::net::fetch fetch;
2829
std::unique_ptr<manapi::net::http::response> resp;
2930
};
31+
#endif
3032

3133
std::string manapi::net::http::internal::generate_default_page(int status, std::string_view msg) {
3234
return std::format("<html>\n\t<head>\n\t\t"

src/json/ManapiJson.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ manapi::error::status manapi::json::parse_(STRING_VIEW plain_text, bool use_bigi
255255
return error::status_ok();
256256
}
257257
#else
258-
void manapi::json::parse_(STRING_VIEW plain_text) {
258+
manapi::error::status manapi::json::parse_(STRING_VIEW plain_text) {
259259
json_builder builder (json_mask(nullptr));
260260
auto res = builder.parse(plain_text);
261261
if (!res.ok())
262262
return std::move(res);
263263
auto rhs = builder.get();
264264
if (!rhs.ok())
265265
return std::move(rhs.err());
266-
*this = std::move(rhs.value());
266+
*this = rhs.unwrap();
267267
return error::status_ok();
268268
}
269269
#endif
@@ -1560,7 +1560,7 @@ bool manapi::json::operator<=(DECIMAL n) const {
15601560
bool manapi::json::operator==(const NULLPTR &n) const {
15611561
return this->is_null();
15621562
}
1563-
1563+
#ifdef MANAPIHTTP_BIGINT_SUPPORT
15641564
bool manapi::json::operator!=(const BIGINT &n) const {
15651565
return !this->operator==(n);
15661566
}
@@ -1621,6 +1621,8 @@ bool manapi::json::operator>=(const BIGINT &n) const {
16211621

16221622
}
16231623

1624+
#endif
1625+
16241626
manapi::json manapi::json::operator-(INTEGER num) const {
16251627
return std::move(this->operator+(-num));
16261628
}

tests/test_fs.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
//#ifdef MANAPIHTTP_HTTP_AS_EXECUTABLE
21
# include "ManapiInitTools.hpp"
32
# include "ManapiProcess.hpp"
43
# include "json/ManapiJson.hpp"
54
# include "json/ManapiJsonMask.hpp"
65
# include "json/ManapiJsonBuilder.hpp"
76
# include "fs/ManapiFilesystem.hpp"
8-
// #else
9-
// # include <manapihttp/ManapiInitTools.hpp>
10-
// # include <manapihttp/ManapiProcess.hpp>
11-
// # include <manapihttp/json/ManapiJson.hpp>
12-
// # include <manapihttp/json/ManapiJsonMask.hpp>
13-
// # include <manapihttp/json/ManapiJsonBuilder.hpp>
14-
// # include <manapihttp/fs/ManapiFilesystem.hpp>
15-
// #endif
16-
177
#include "./utest.h"
188

199
UTEST(fs_path, join_1) {

0 commit comments

Comments
 (0)