Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions runtime-light/stdlib/curl/curl-easy-functions.h

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions runtime-light/stdlib/curl/curl-multi-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "runtime-light/stdlib/web-transfer-lib/web-simple-transfer.h"

inline auto f$curl_multi_init() noexcept -> kphp::coro::task<kphp::web::curl::multi_type> {
auto open_res{co_await kphp::forks::id_managed(kphp::web::composite_transfer_open(kphp::web::transfer_backend::CURL))};
auto open_res{co_await kphp::forks::id_managed(kphp::web::composite::open(kphp::web::transfer_backend::CURL))};
if (!open_res.has_value()) [[unlikely]] {
kphp::web::curl::print_warning("could not initialize a new curl multi handle", std::move(open_res.error()));
co_return 0;
Expand All @@ -45,7 +45,7 @@ inline auto f$curl_multi_add_handle(kphp::web::curl::multi_type multi_id, kphp::
auto& easy_ctx{curl_state.easy_ctx.get_or_init(easy_id)};
easy_ctx.errors_reset();

auto res{co_await kphp::forks::id_managed(kphp::web::composite_transfer_add(kphp::web::composite_transfer{multi_id}, kphp::web::simple_transfer{easy_id}))};
auto res{co_await kphp::forks::id_managed(kphp::web::composite::add(kphp::web::composite::transfer{multi_id}, kphp::web::simple::transfer{easy_id}))};
if (!res.has_value()) [[unlikely]] {
multi_ctx.set_errno(res.error().code);
kphp::web::curl::print_warning("could not add a curl easy handler into multi handle", std::move(res.error()));
Expand All @@ -65,8 +65,7 @@ inline auto f$curl_multi_remove_handle(kphp::web::curl::multi_type multi_id,
if (!curl_state.easy_ctx.has(easy_id)) [[unlikely]] {
co_return false;
}
auto res{
co_await kphp::forks::id_managed(kphp::web::composite_transfer_remove(kphp::web::composite_transfer{multi_id}, kphp::web::simple_transfer{easy_id}))};
auto res{co_await kphp::forks::id_managed(kphp::web::composite::remove(kphp::web::composite::transfer{multi_id}, kphp::web::simple::transfer{easy_id}))};
if (!res.has_value()) [[unlikely]] {
multi_ctx.set_errno(res.error().code);
kphp::web::curl::print_warning("could not remove a curl easy handler from multi handle", std::move(res.error()));
Expand All @@ -82,7 +81,7 @@ inline auto f$curl_multi_setopt(kphp::web::curl::multi_type multi_id, int64_t op
return false;
}
auto& multi_ctx{curl_state.multi_ctx.get_or_init(multi_id)};
auto ct{kphp::web::composite_transfer{.descriptor = multi_id}};
auto ct{kphp::web::composite::transfer{.descriptor = multi_id}};

switch (static_cast<kphp::web::curl::CURMLOPT>(option)) {
// long options
Expand All @@ -92,7 +91,7 @@ inline auto f$curl_multi_setopt(kphp::web::curl::multi_type multi_id, int64_t op
case kphp::web::curl::CURLPIPE::NOTHING:
case kphp::web::curl::CURLPIPE::HTTP1:
case kphp::web::curl::CURLPIPE::MULTIPLEX: {
auto res{kphp::web::set_transfer_property(ct, option, kphp::web::property_value::as_long(std::to_underlying(pipeling_type)))};
auto res{kphp::web::property::set(ct, option, kphp::web::property::value::as_long(std::to_underlying(pipeling_type)))};
if (!res.has_value()) [[unlikely]] {
kphp::web::curl::print_warning("could not set an mutli option", std::move(res.error()));
return false;
Expand All @@ -109,7 +108,7 @@ inline auto f$curl_multi_setopt(kphp::web::curl::multi_type multi_id, int64_t op
case kphp::web::curl::CURMLOPT::MAX_HOST_CONNECTIONS:
case kphp::web::curl::CURMLOPT::MAX_PIPELINE_LENGTH:
case kphp::web::curl::CURMLOPT::MAX_TOTAL_CONNECTIONS: {
auto res{kphp::web::set_transfer_property(ct, option, kphp::web::property_value::as_long(value))};
auto res{kphp::web::property::set(ct, option, kphp::web::property::value::as_long(value))};
if (!res.has_value()) [[unlikely]] {
kphp::web::curl::print_warning("could not set an multi option", std::move(res.error()));
return false;
Expand All @@ -128,7 +127,7 @@ inline auto f$curl_multi_exec(kphp::web::curl::multi_type multi_id, int64_t& sti
if (!curl_state.multi_ctx.has(multi_id)) [[unlikely]] {
co_return false;
}
auto res{co_await kphp::forks::id_managed(kphp::web::composite_transfer_perform(kphp::web::composite_transfer{multi_id}))};
auto res{co_await kphp::forks::id_managed(kphp::web::composite::perform(kphp::web::composite::transfer{multi_id}))};
auto& multi_ctx{curl_state.multi_ctx.get_or_init(multi_id)};
if (!res.has_value()) [[unlikely]] {
multi_ctx.set_errno(res.error().code);
Expand All @@ -147,7 +146,7 @@ inline auto f$curl_multi_getcontent(kphp::web::curl::easy_type easy_id) noexcept
}
auto& easy_ctx{curl_state.easy_ctx.get_or_init(easy_id)};
if (easy_ctx.return_transfer) {
auto res{co_await kphp::forks::id_managed(kphp::web::simple_transfer_get_response(kphp::web::simple_transfer{easy_id}))};
auto res{co_await kphp::forks::id_managed(kphp::web::simple::get_response(kphp::web::simple::transfer{easy_id}))};
if (!res.has_value()) [[unlikely]] {
easy_ctx.set_errno(res.error().code);
kphp::web::curl::print_warning("could not get response of curl easy handle", std::move(res.error()));
Expand All @@ -164,7 +163,7 @@ inline auto f$curl_multi_close(kphp::web::curl::multi_type multi_id) noexcept ->
co_return;
}
auto& multi_ctx{curl_state.multi_ctx.get_or_init(multi_id)};
auto res{co_await kphp::forks::id_managed(kphp::web::composite_transfer_close(kphp::web::composite_transfer{multi_id}))};
auto res{co_await kphp::forks::id_managed(kphp::web::composite::close(kphp::web::composite::transfer{multi_id}))};
if (!res.has_value()) [[unlikely]] {
multi_ctx.set_errno(res.error().code);
kphp::web::curl::print_warning("could not close curl multi handle", std::move(res.error()));
Expand Down Expand Up @@ -224,8 +223,8 @@ inline auto f$curl_multi_select(kphp::web::curl::multi_type multi_id, double tim
co_return false;
}
auto& multi_ctx{curl_state.multi_ctx.get_or_init(multi_id)};
auto res{co_await kphp::forks::id_managed(kphp::web::composite_transfer_wait_updates(
kphp::web::composite_transfer{multi_id}, std::chrono::duration_cast<std::chrono::seconds>(std::chrono::duration<double>{timeout})))};
auto res{co_await kphp::forks::id_managed(kphp::web::composite::wait_updates(
kphp::web::composite::transfer{multi_id}, std::chrono::duration_cast<std::chrono::seconds>(std::chrono::duration<double>{timeout})))};
if (!res.has_value()) [[unlikely]] {
multi_ctx.set_errno(res.error().code);
kphp::web::curl::print_warning("could not select curl multi handle", std::move(res.error()));
Expand All @@ -245,7 +244,7 @@ inline auto f$curl_multi_info_read(kphp::web::curl::multi_type multi_id,
constexpr auto CURL_MULTI_INFO_READ_OPTION = 0;

auto props{co_await kphp::forks::id_managed(
kphp::web::get_transfer_properties(kphp::web::composite_transfer{multi_id}, CURL_MULTI_INFO_READ_OPTION, kphp::web::get_properties_policy::load))};
kphp::web::property::get(kphp::web::composite::transfer{multi_id}, CURL_MULTI_INFO_READ_OPTION, kphp::web::property::get_policy::load))};
if (!props.has_value()) [[unlikely]] {
multi_ctx.set_errno(props.error().code, props.error().description);
kphp::web::curl::print_warning("could not get info message of multi handle", std::move(props.error()));
Expand Down
4 changes: 2 additions & 2 deletions runtime-light/stdlib/curl/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ enum class PHPCURL : uint64_t {
RETURNTRANSFER = 1234567,
};

using easy_type = simple_transfer::descriptor_type;
using multi_type = composite_transfer::descriptor_type;
using easy_type = simple::transfer::descriptor_type;
using multi_type = composite::transfer::descriptor_type;

constexpr auto CURL_DIAGNOSTICS_MSG_SIZE = 256;

Expand Down
Loading
Loading