Skip to content

AndreGleichner/cprex

Repository files navigation

Playground for cpr extensions

See https://github.com/libcpr/cpr

Tries the following:

  • Factory to store named sets of standard Session configurations (baseURL, Header, Parameters, Redirects, HTTP proxies)
  • All Session objects created share DNS, connection, SSL and cookie cache
  • Sessions are configured with a retry policy with backof
  • Can invoke verbs (Get, etc) with relative URLs, otherwise same parameters as cpr
  • Proxy autodiscovery via libproxy
  • proxy connectivity test on session creation
  • during request retries optionally try connects w/o proxy

It provides a class cprex::Session utilizing cpr::Session.

No MultiPerform yet.

Basic use:

cprex::Factory::PrepareSession("ipify", "https://api64.ipify.org");
cprex::Factory::PrepareSession("stat", "https://httpstat.us/");
...
auto ipify = cprex::Factory::CreateSession("ipify");
auto r = ipify.Get("/");
...
auto stat = cprex::Factory::CreateSession("stat");
r = stat.Get("/200");

Some parameter:

r = stat.Get("/200", cpr::Parameters {{"sleep", "5000"}});

TODOs:

About

Playground for cpr extensions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages