Represetns a Http request. More...
#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/Utils/Http.hpp>
Classes | |
| struct | Progress |
| struct | priv |
Public Types | |
| typedef std::shared_ptr< Http > | Ptr |
| typedef std::function< void(std::string, unsigned)> | CompleteFn |
| typedef std::function< void(std::string, std::string, unsigned)> | ErrorFn |
| typedef std::function< void(Progress, bool &)> | ProgressFn |
| typedef std::function< void(std::string)> | IPResolveFn |
| typedef std::function< void(std::string headers)> | HeaderCallbackFn |
Public Member Functions | |
| Http (Http &&other) | |
| ~Http () | |
| Http (const Http &)=delete | |
| Http & | operator= (const Http &)=delete |
| Http & | operator= (Http &&)=delete |
| Http & | timeout_connect (long timeout) |
| Http & | timeout_max (long timeout) |
| Http & | size_limit (size_t sizeLimit) |
| Http & | set_range (const std::string &range) |
| Http & | header (std::string name, const std::string &value) |
| Http & | headers_reset () |
| Http & | remove_header (std::string name) |
| Http & | auth_digest (const std::string &user, const std::string &password) |
| Http & | auth_basic (const std::string &user, const std::string &password) |
| Http & | ca_file (const std::string &filename) |
| Http & | tls_verify (bool enable) |
| Http & | form_clear () |
| Http & | form_add (const std::string &name, const std::string &contents) |
| Http & | form_add_file (const std::string &name, const boost::filesystem::path &path, boost::filesystem::ifstream::off_type offset=0, size_t length=0) |
| Http & | mime_form_add_text (std::string &name, std::string &value) |
| Http & | mime_form_add_file (std::string &name, const char *path) |
| Http & | form_add_file (const std::wstring &name, const boost::filesystem::path &path, boost::filesystem::ifstream::off_type offset=0, size_t length=0) |
| Http & | form_add_file (const std::string &name, const boost::filesystem::path &path, const std::string &filename, boost::filesystem::ifstream::off_type offset=0, size_t length=0) |
| Http & | set_post_body (const boost::filesystem::path &path) |
| Http & | set_post_body (const std::string &body) |
| Http & | set_put_body (const boost::filesystem::path &path) |
| Http & | set_del_body (const std::string &body) |
| Http & | on_complete (CompleteFn fn) |
| Http & | on_error (ErrorFn fn) |
| Http & | on_progress (ProgressFn fn) |
| Http & | on_ip_resolve (IPResolveFn fn) |
| Http & | on_header_callback (HeaderCallbackFn fn) |
| Ptr | perform () |
| void | perform_sync () |
| void | cancel () |
| void | print () const |
Static Public Member Functions | |
| static Http | get (std::string url) |
| static Http | post (std::string url) |
| static Http | put (std::string url) |
| static Http | del (std::string url) |
| static Http | put2 (std::string url) |
| static Http | patch (std::string url) |
| static void | set_extra_headers (std::map< std::string, std::string > headers) |
| static std::map< std::string, std::string > | get_extra_headers () |
| static bool | ca_file_supported () |
| static std::string | tls_global_init () |
| static std::string | tls_system_cert_store () |
| static std::string | url_encode (const std::string &str) |
| static std::string | url_decode (const std::string &str) |
| static std::string | get_filename_from_url (const std::string &url) |
| static std::string | get_host_from_url (const std::string &url, std::string *port=nullptr) |
| static std::string | get_host_header_value (const std::string &url) |
Private Member Functions | |
| Http (const std::string &url) | |
Private Attributes | |
| std::unique_ptr< priv > | p |
Represetns a Http request.
| typedef std::function<void(std::string , unsigned )> Slic3r::Http::CompleteFn |
| typedef std::function<void(std::string , std::string , unsigned )> Slic3r::Http::ErrorFn |
| typedef std::function<void(std::string headers)> Slic3r::Http::HeaderCallbackFn |
| typedef std::function<void(std::string)> Slic3r::Http::IPResolveFn |
| typedef std::function<void(Progress, bool& )> Slic3r::Http::ProgressFn |
| typedef std::shared_ptr<Http> Slic3r::Http::Ptr |
| Slic3r::Http::Http | ( | Http && | other | ) |
Referenced by Http(), Http(), auth_basic(), auth_digest(), ca_file(), del(), form_add(), form_add_file(), form_add_file(), form_add_file(), form_clear(), get(), header(), headers_reset(), mime_form_add_file(), mime_form_add_text(), on_complete(), on_error(), on_header_callback(), on_ip_resolve(), on_progress(), operator=(), operator=(), patch(), post(), put(), put2(), remove_header(), set_del_body(), set_post_body(), set_post_body(), set_put_body(), set_range(), size_limit(), timeout_connect(), timeout_max(), and tls_verify().
| Slic3r::Http::~Http | ( | ) |
|
delete |
|
private |
References Slic3r::extra_headers, Slic3r::g_mutex, header(), and p.
| Http & Slic3r::Http::auth_basic | ( | const std::string & | user, |
| const std::string & | password ) |
| Http & Slic3r::Http::auth_digest | ( | const std::string & | user, |
| const std::string & | password ) |
| Http & Slic3r::Http::ca_file | ( | const std::string & | filename | ) |
References Http(), Slic3r::Http::priv::ca_file_supported(), and p.
|
static |
References Slic3r::Http::priv::ca_file_supported().
Referenced by Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::PhysicalPrinterDialog::build_printhost_settings(), and Slic3r::GUI::InputIpAddressDialog::on_ok().
|
static |
References Http(), and Slic3r::http.
Referenced by Slic3r::OrcaCloudServiceAgent::http_delete().
| Http & Slic3r::Http::form_add | ( | const std::string & | name, |
| const std::string & | contents ) |
| Http & Slic3r::Http::form_add_file | ( | const std::string & | name, |
| const boost::filesystem::path & | path, | ||
| boost::filesystem::ifstream::off_type | offset = 0, | ||
| size_t | length = 0 ) |
References Http(), Slic3r::length(), and Slic3r::offset().
| Http & Slic3r::Http::form_add_file | ( | const std::string & | name, |
| const boost::filesystem::path & | path, | ||
| const std::string & | filename, | ||
| boost::filesystem::ifstream::off_type | offset = 0, | ||
| size_t | length = 0 ) |
References Http(), Slic3r::length(), and Slic3r::offset().
| Http & Slic3r::Http::form_add_file | ( | const std::wstring & | name, |
| const boost::filesystem::path & | path, | ||
| boost::filesystem::ifstream::off_type | offset = 0, | ||
| size_t | length = 0 ) |
References Http(), Slic3r::length(), and Slic3r::offset().
| Http & Slic3r::Http::form_clear | ( | ) |
References Http(), Slic3r::f(), and p.
|
static |
References Http().
Referenced by Slic3r::UltiMaker::auth_status(), Slic3r::PresetUpdater::priv::check_new_vendors(), Slic3r::GUI::GUI_App::check_new_version(), Slic3r::GUI::GUI_App::check_new_version_sf(), Slic3r::GUI::GUI_App::check_privacy_version(), Slic3r::Duet::connect(), Slic3r::UltiMaker::connect(), Slic3r::GUI::ScoreDialog::create_oss_thumbnail(), Slic3r::Duet::disconnect(), Slic3r::UltiMaker::disconnect(), Slic3r::SimplyPrint::do_chunk_upload(), Slic3r::CloudPluginService::download_cloud_plugin(), Slic3r::GUI::HMSQuery::download_hms_related(), Slic3r::GUI::GUI_App::download_plugin(), Slic3r::ElegooLink::elegoo_cc2_test(), Slic3r::ElegooLink::elegoo_test(), Slic3r::MoonrakerPrinterAgent::fetch_device_info(), Slic3r::QidiPrinterAgent::fetch_filament_dict(), Slic3r::SnapmakerPrinterAgent::fetch_filament_info(), Slic3r::MoonrakerPrinterAgent::fetch_hh_filament_info(), Slic3r::MoonrakerPrinterAgent::fetch_moonraker_filament_data(), Slic3r::MoonrakerPrinterAgent::fetch_object_list(), Slic3r::QidiPrinterAgent::fetch_slot_info(), Slic3r::GUI::get_error_message(), Slic3r::PresetUpdater::priv::get_file(), Slic3r::Repetier::get_groups(), Slic3r::GUI::get_hms_info_version(), Slic3r::GUI::FileGet::priv::get_perform(), Slic3r::ElegooLink::get_print_host_webui(), Slic3r::Obico::get_printers(), Slic3r::Repetier::get_printers(), Slic3r::Moonraker::get_storage(), Slic3r::PrusaLink::get_storage(), Slic3r::OrcaCloudServiceAgent::http_get(), Slic3r::GUI::Plater::import_model_id(), Slic3r::UltiMaker::is_authorized(), Slic3r::GUI::BindMachineDialog::on_show(), Slic3r::GUI::UnBindMachineDialog::on_show(), Slic3r::anonymous_namespace{CrealityHostDiscovery.cpp}::probe_info(), Slic3r::MoonrakerPrinterAgent::query_printer_status(), Slic3r::OrcaCloudServiceAgent::run_health_check(), Slic3r::Duet::start_print(), Slic3r::ESP3D::start_print(), Slic3r::UltiMaker::start_print(), Slic3r::GUI::NetworkTestDialog::start_test_url(), Slic3r::PresetUpdater::priv::sync_resources(), Slic3r::PresetUpdater::priv::sync_vendor_config(), Slic3r::PresetUpdater::priv::sync_version(), Slic3r::AstroBox::test(), Slic3r::CrealityPrint::test(), Slic3r::ESP3D::test(), Slic3r::FlashAir::test(), Slic3r::Moonraker::test(), Slic3r::Obico::test(), Slic3r::OctoPrint::test(), Slic3r::PrusaLink::test(), Slic3r::Repetier::test(), Slic3r::SimplyPrint::test(), Slic3r::UltiMaker::test(), Slic3r::PrusaLink::test_with_method_check(), and Slic3r::FlashAir::upload().
|
static |
References Slic3r::extra_headers, and Slic3r::g_mutex.
Referenced by Slic3r::PresetUpdater::priv::sync_plugins().
|
static |
|
static |
Referenced by Slic3r::MachineObject::connect(), get_host_header_value(), Slic3r::GUI::InputIpAddressDialog::isValidEndpoint(), Slic3r::ElegooLink::loopUpload(), Slic3r::GUI::InputIpAddressDialog::on_ok(), Slic3r::ElegooLink::upload(), Slic3r::OctoPrint::upload(), and Slic3r::ws_connect().
|
static |
References get_host_from_url().
Referenced by Slic3r::ElegooLink::elegoo_cc2_test(), Slic3r::ElegooLink::get_print_host_webui(), Slic3r::anonymous_namespace{ElegooLink.cpp}::lookup_cc2_serial_impl(), Slic3r::ElegooLink::loopUpload(), Slic3r::PrusaLink::post_inner(), Slic3r::PrusaLink::put_inner(), Slic3r::ElegooLink::upload_inner_with_host(), and Slic3r::OctoPrint::upload_inner_with_host().
| Http & Slic3r::Http::header | ( | std::string | name, |
| const std::string & | value ) |
Referenced by Http(), Slic3r::GUI::GUI_App::download_plugin(), headers_reset(), and print().
| Http & Slic3r::Http::headers_reset | ( | ) |
References Http(), Slic3r::extra_headers, Slic3r::g_mutex, header(), and p.
| Http & Slic3r::Http::mime_form_add_file | ( | std::string & | name, |
| const char * | path ) |
| Http & Slic3r::Http::mime_form_add_text | ( | std::string & | name, |
| std::string & | value ) |
| Http & Slic3r::Http::on_complete | ( | CompleteFn | fn | ) |
Referenced by Slic3r::GUI::GUI_App::download_plugin().
Referenced by Slic3r::PresetUpdater::priv::check_new_vendors(), and Slic3r::PresetUpdater::priv::sync_vendor_config().
| Http & Slic3r::Http::on_header_callback | ( | HeaderCallbackFn | fn | ) |
Referenced by Slic3r::GUI::FileGet::priv::get_perform().
| Http & Slic3r::Http::on_ip_resolve | ( | IPResolveFn | fn | ) |
| Http & Slic3r::Http::on_progress | ( | ProgressFn | fn | ) |
Referenced by Slic3r::PresetUpdater::priv::check_new_vendors(), Slic3r::PresetUpdater::priv::get_file(), Slic3r::PresetUpdater::priv::sync_vendor_config(), and Slic3r::PresetUpdater::priv::sync_version().
|
static |
| Http::Ptr Slic3r::Http::perform | ( | ) |
|
static |
References Http(), and Slic3r::http.
Referenced by Slic3r::PresetUpdater::priv::check_new_vendors(), Slic3r::SimplyPrint::do_api_call(), Slic3r::SimplyPrint::do_chunk_upload(), Slic3r::SimplyPrint::do_temp_upload(), Slic3r::UltiMaker::generate_auth_creds(), Slic3r::OrcaCloudServiceAgent::http_post(), Slic3r::OrcaCloudServiceAgent::http_post_auth(), Slic3r::OrcaCloudServiceAgent::http_post_token(), Slic3r::ElegooLink::loopUpload(), Slic3r::PrusaLink::post_inner(), Slic3r::GUI::OAuthJob::process(), Slic3r::Flashforge::request_local_api_json(), Slic3r::OrcaCloudServiceAgent::request_web_session_handoff(), Slic3r::C3DPrinterOS::send_form(), Slic3r::MoonrakerPrinterAgent::send_gcode_async(), Slic3r::MoonrakerPrinterAgent::send_gcode_sync(), Slic3r::GUI::SendSystemInfoDialog::send_info(), Slic3r::MoonrakerPrinterAgent::send_jsonrpc_command(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::SendRequest(), Slic3r::Duet::start_print(), Slic3r::Moonraker::start_print(), Slic3r::UltiMaker::start_print(), Slic3r::AstroBox::upload(), Slic3r::C3DPrinterOS::upload(), Slic3r::CrealityPrint::upload(), Slic3r::Duet::upload(), Slic3r::ESP3D::upload(), Slic3r::FlashAir::upload(), Slic3r::MKS::upload(), Slic3r::Moonraker::upload(), Slic3r::Obico::upload(), Slic3r::Repetier::upload(), Slic3r::UltiMaker::upload(), Slic3r::MoonrakerPrinterAgent::upload_gcode(), Slic3r::OctoPrint::upload_inner_with_host(), and Slic3r::Flashforge::upload_local_api().
| void Slic3r::Http::print | ( | ) | const |
|
static |
References Http(), and Slic3r::http.
Referenced by Slic3r::OrcaCloudServiceAgent::http_put(), Slic3r::PrusaLink::put_inner(), Slic3r::Duet::upload(), and Slic3r::UltiMaker::upload().
|
static |
References Http(), and Slic3r::http.
Referenced by Slic3r::ElegooLink::loopUploadCC2().
| Http & Slic3r::Http::remove_header | ( | std::string | name | ) |
| Http & Slic3r::Http::set_del_body | ( | const std::string & | body | ) |
|
static |
References Slic3r::extra_headers, and Slic3r::g_mutex.
Referenced by Slic3r::PresetUpdater::priv::sync_plugins().
| Http & Slic3r::Http::set_post_body | ( | const boost::filesystem::path & | path | ) |
| Http & Slic3r::Http::set_post_body | ( | const std::string & | body | ) |
| Http & Slic3r::Http::set_put_body | ( | const boost::filesystem::path & | path | ) |
| Http & Slic3r::Http::set_range | ( | const std::string & | range | ) |
References Http(), p, and Slic3r::range().
Referenced by Slic3r::GUI::FileGet::priv::get_perform().
| Http & Slic3r::Http::size_limit | ( | size_t | sizeLimit | ) |
Referenced by Slic3r::GUI::FileGet::priv::get_perform(), and Slic3r::PresetUpdater::priv::sync_version().
| Http & Slic3r::Http::timeout_connect | ( | long | timeout | ) |
References Http(), Slic3r::Http::priv::DEFAULT_TIMEOUT_CONNECT, and p.
Referenced by Slic3r::PresetUpdater::priv::check_new_vendors(), Slic3r::GUI::GUI_App::download_plugin(), and Slic3r::PresetUpdater::priv::sync_vendor_config().
| Http & Slic3r::Http::timeout_max | ( | long | timeout | ) |
References Http(), Slic3r::Http::priv::DEFAULT_TIMEOUT_MAX, and p.
Referenced by Slic3r::GUI::GUI_App::download_plugin().
|
static |
References Slic3r::CurlGlobalInit::instance.
Referenced by Slic3r::Http::priv::priv(), and Slic3r::GUI::GUI_App::on_init_inner().
|
static |
Referenced by Slic3r::GUI::GUI_App::on_init_inner().
| Http & Slic3r::Http::tls_verify | ( | bool | enable | ) |
|
static |
Referenced by Slic3r::GUI::session::read_next_line(), and Slic3r::GUI::GUI_App::url_decode().
|
static |
Referenced by Slic3r::PresetUpdater::priv::check_new_vendors(), Slic3r::OrcaCloudServiceAgent::fetch_plugin_changelogs(), Slic3r::C3DPrinterOS::get_api_auth_token(), Slic3r::C3DPrinterOS::get_cloud_printer_types(), Slic3r::Duet::get_connect_url(), Slic3r::OrcaCloudServiceAgent::get_plugin_download_url(), Slic3r::OrcaCloudServiceAgent::get_plugin_url(), Slic3r::Duet::get_upload_url(), Slic3r::MKS::get_upload_url(), Slic3r::UltiMaker::get_upload_url(), Slic3r::GUI::Plater::priv::on_select_preset(), Slic3r::resolve_recovery_url(), Slic3r::Duet::start_print(), Slic3r::ESP3D::start_print(), Slic3r::UltiMaker::start_print(), Slic3r::PresetUpdater::priv::sync_vendor_config(), Slic3r::OrcaCloudServiceAgent::unsubscribe_plugins(), Slic3r::C3DPrinterOS::update_file(), Slic3r::CrealityPrint::upload(), Slic3r::GUI::GUI_App::url_encode(), and Slic3r::url_encode().
|
private |
Referenced by Http(), Http(), ~Http(), auth_basic(), auth_digest(), ca_file(), cancel(), form_add(), form_clear(), header(), headers_reset(), mime_form_add_file(), mime_form_add_text(), on_complete(), on_error(), on_header_callback(), on_ip_resolve(), on_progress(), perform_sync(), print(), remove_header(), set_del_body(), set_post_body(), set_put_body(), set_range(), size_limit(), timeout_connect(), timeout_max(), and tls_verify().