From 66f698fab6b09a89412736d4e4bd010f1f6b5848 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 16 May 2020 00:50:52 -0400 Subject: [PATCH] Fixed build errors with some examples --- example/simplecli.cc | 11 +++++------ example/sse.cc | 12 ++++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/example/simplecli.cc b/example/simplecli.cc index a9089a3..86efdea 100644 --- a/example/simplecli.cc +++ b/example/simplecli.cc @@ -14,13 +14,12 @@ using namespace std; int main(void) { #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - httplib::url::Options options; - options.ca_cert_file_path = CA_CERT_FILE; - // options.server_certificate_verification = true; - - auto res = httplib::url::Get("https://localhost:8080/hi", options); + auto res = httplib::Client2("https://localhost:8080") + .set_ca_cert_path(CA_CERT_FILE) + // .enable_server_certificate_verification(true) + .Get("/hi"); #else - auto res = httplib::url::Get("http://localhost:8080/hi"); + auto res = httplib::Client2("http://localhost:8080").Get("/hi"); #endif if (res) { diff --git a/example/sse.cc b/example/sse.cc index cce1e6b..6ef382b 100644 --- a/example/sse.cc +++ b/example/sse.cc @@ -80,15 +80,19 @@ int main(void) { svr.Get("/event1", [&](const Request & /*req*/, Response &res) { cout << "connected to event1..." << endl; res.set_header("Content-Type", "text/event-stream"); - res.set_chunked_content_provider( - [&](uint64_t /*offset*/, DataSink &sink) { ed.wait_event(&sink); }); + res.set_chunked_content_provider([&](size_t /*offset*/, DataSink &sink) { + ed.wait_event(&sink); + return true; + }); }); svr.Get("/event2", [&](const Request & /*req*/, Response &res) { cout << "connected to event2..." << endl; res.set_header("Content-Type", "text/event-stream"); - res.set_chunked_content_provider( - [&](uint64_t /*offset*/, DataSink &sink) { ed.wait_event(&sink); }); + res.set_chunked_content_provider([&](size_t /*offset*/, DataSink &sink) { + ed.wait_event(&sink); + return true; + }); }); thread t([&] {