Add convenience wrapper App (again)

This commit is contained in:
Alex Hultman
2018-09-15 23:56:30 +02:00
parent 883bdfe7d7
commit 6fadfabec1
7 changed files with 83 additions and 168 deletions
+7
View File
@@ -75,6 +75,13 @@ public:
}
}
/* Convenience function for static data (I don't like this one!) */
void write(std::string_view data) {
write([data](int offset) {
return data.substr(offset);
}, data.length());
}
/* Attach a read handler for data sent. Will be called with a chunk of size 0 when FIN */
void read(std::function<void(std::string_view)> handler) {
HttpResponseData<SSL> *data = getHttpResponseData();