Make HttpParser only handle move-only functions

This commit is contained in:
Alex Hultman
2019-01-23 12:31:25 +01:00
parent 95478c906f
commit e653e9d314
+4 -2
View File
@@ -25,6 +25,8 @@
#include <cstring>
#include <algorithm>
#include "f2/function2.hpp"
namespace uWS {
class HttpRequest {
@@ -138,7 +140,7 @@ private:
// the only caller of getHeaders
template <int CONSUME_MINIMALLY>
std::pair<int, void *> fenceAndConsumePostPadded(char *data, int length, void *user, HttpRequest *req, std::function<void *(void *, HttpRequest *)> &requestHandler, std::function<void *(void *, std::string_view, bool)> &dataHandler) {
std::pair<int, void *> fenceAndConsumePostPadded(char *data, int length, void *user, HttpRequest *req, fu2::unique_function<void *(void *, HttpRequest *)> &requestHandler, fu2::unique_function<void *(void *, std::string_view, bool)> &dataHandler) {
int consumedTotal = 0;
data[length] = '\r';
@@ -191,7 +193,7 @@ private:
public:
// todo: what can we do with the socket inside the handlers? we need to check on return from any handler if we closed or terminated or upgraded the socket
void *consumePostPadded(char *data, int length, void *user, std::function<void *(void *, HttpRequest *)> &&requestHandler, std::function<void *(void *, std::string_view, bool)> &&dataHandler, std::function<void *(void *)> &&errorHandler) {
void *consumePostPadded(char *data, int length, void *user, fu2::unique_function<void *(void *, HttpRequest *)> &&requestHandler, fu2::unique_function<void *(void *, std::string_view, bool)> &&dataHandler, fu2::unique_function<void *(void *)> &&errorHandler) {
HttpRequest req;