#include "pip.h" using namespace PICoutManipulators; PIKbdListener kbd; const char * pageTitle = "" "" "" "

Title

" "" ""; int main(int argc, char * argv[]) { // piCout << PIString::readableSize(PISystemMonitor::usedRAM()); PIVector vi; piForTimes(10) { piSleep(2.); vi.enlarge(1000000); piCout << "now" << vi.size() << vi.capacity(); } piSleep(5.); /*kbd.enableExitCapture(); PIHTTPServer server; server.setFavicon(PIFile::readAll("logo.png", false)); // server.setOption(MicrohttpdServer::Option::HTTPSEnabled, true); server.listen({"127.0.0.1", 7777}); // server.listen({"192.168.1.10", 7778}); server.registerPath("/", MicrohttpdServer::Method::Get, [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody(PIByteArray::fromAscii(pageTitle)); return ret; }); server.registerPath("/html", MicrohttpdServer::Method::Get, [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody("

arg=%1

"_a.arg(r.args.value("a0")).toUTF8()); return ret; }); server.registerPath("/api", MicrohttpdServer::Method::Put, [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody(PIByteArray::fromAscii("API")); return ret; }); server.registerPath("/api/", MicrohttpdServer::Method::Post, [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody("API etry %1"_a.arg(r.path).toUTF8()); ret.setCode(405); return ret; }); server.registerUnhandled([](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody("Unknown"_a.arg(r.path).toUTF8()); ret.setCode(404); return ret; });*/ /*server.setRequestCallback([](MicrohttpdServer::Request r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply rep; piCout << "request" << r.path; piCout << " header" << r.headers; piCout << " args" << r.args; piCout << " body" << r.body; piCout << ""; rep.setBody(PIByteArray::fromAscii("[{\"value1\": true, \"value2\": \"ыекштп\"}]")); return rep; });*/ /*piCout << "start" << server.isListen(); WAIT_FOR_EXIT server.stop();*/ return 0; }