Make it barely benchmarkable again
This commit is contained in:
@@ -1,12 +1,37 @@
|
||||
// uWS.h
|
||||
#include "Hub.h"
|
||||
|
||||
char largeBuf[] = "HTTP/1.1 200 OK\r\nContent-Length: 512\r\n\r\n";
|
||||
int largeHttpBufSize = sizeof(largeBuf) + 512 - 1;
|
||||
char *largeHttpBuf;
|
||||
|
||||
int main() {
|
||||
largeHttpBuf = (char *) malloc(largeHttpBufSize);
|
||||
memcpy(largeHttpBuf, largeBuf, sizeof(largeBuf) - 1);
|
||||
|
||||
std::cout << "HttpSocket size: " << sizeof(HttpSocket) << std::endl;
|
||||
|
||||
// either use this, or use onHttpRoute but not both
|
||||
uWS::defaultHub.onHttpRequest([](HttpSocket *s, HttpRequest *req) {
|
||||
|
||||
// we do not care for routers just yet!
|
||||
if (req->getUrl() == "/") {
|
||||
// just write back for now!
|
||||
|
||||
us_socket *us = (us_socket *) s;
|
||||
us_socket_write(us, largeHttpBuf, largeHttpBufSize, 0);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
std::cout << "Got HTTP request at URL: " << req->getUrl() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
// get the URL here!
|
||||
|
||||
|
||||
|
||||
// an http socket can BOTH send buffered data AND have one stream in and one stream out!
|
||||
|
||||
// writeStatus(234314234)
|
||||
|
||||
Reference in New Issue
Block a user