File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,12 @@ using namespace std;
1414
1515int main (void ) {
1616#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
17- httplib::url::Options options;
18- options.ca_cert_file_path = CA_CERT_FILE;
19- // options.server_certificate_verification = true;
20-
21- auto res = httplib::url::Get (" https://localhost:8080/hi" , options);
17+ auto res = httplib::Client2 (" https://localhost:8080" )
18+ .set_ca_cert_path (CA_CERT_FILE)
19+ // .enable_server_certificate_verification(true)
20+ .Get (" /hi" );
2221#else
23- auto res = httplib::url::Get (" http://localhost:8080/hi" );
22+ auto res = httplib::Client2 (" http://localhost:8080" ). Get ( " /hi" );
2423#endif
2524
2625 if (res) {
Original file line number Diff line number Diff line change @@ -80,15 +80,19 @@ int main(void) {
8080 svr.Get (" /event1" , [&](const Request & /* req*/ , Response &res) {
8181 cout << " connected to event1..." << endl;
8282 res.set_header (" Content-Type" , " text/event-stream" );
83- res.set_chunked_content_provider (
84- [&](uint64_t /* offset*/ , DataSink &sink) { ed.wait_event (&sink); });
83+ res.set_chunked_content_provider ([&](size_t /* offset*/ , DataSink &sink) {
84+ ed.wait_event (&sink);
85+ return true ;
86+ });
8587 });
8688
8789 svr.Get (" /event2" , [&](const Request & /* req*/ , Response &res) {
8890 cout << " connected to event2..." << endl;
8991 res.set_header (" Content-Type" , " text/event-stream" );
90- res.set_chunked_content_provider (
91- [&](uint64_t /* offset*/ , DataSink &sink) { ed.wait_event (&sink); });
92+ res.set_chunked_content_provider ([&](size_t /* offset*/ , DataSink &sink) {
93+ ed.wait_event (&sink);
94+ return true ;
95+ });
9296 });
9397
9498 thread t ([&] {
You can’t perform that action at this time.
0 commit comments