Commit 67be2bb0 authored by Elvis Pranskevichus's avatar Elvis Pranskevichus

Add NodeJS HTTP server

parent 17abe9bc
...@@ -175,6 +175,12 @@ benchmarks = [{ ...@@ -175,6 +175,12 @@ benchmarks = [{
'--addr=0.0.0.0:25000'], '--addr=0.0.0.0:25000'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': http_client, 'client': http_client,
}, {
'name': 'http-nodejs',
'title': 'HTTP server (nodejs)',
'server': nodejs + ['/usr/src/servers/nodejs_http_server.js'],
'server_address': tcp_address,
'client': http_client,
}] }]
......
...@@ -100,7 +100,8 @@ class HttpProtocol(asyncio.Protocol): ...@@ -100,7 +100,8 @@ class HttpProtocol(asyncio.Protocol):
else: else:
payload_size = int(payload_size) payload_size = int(payload_size)
response.write(b'X' * payload_size) response.write(b'X' * payload_size)
self._current_headers = [] self._current_parser = None
self._current_request = None
def abort(msg): def abort(msg):
......
var http = require('http');
const PORT = 25000;
function handle(request, response) {
var msize = request.url.substr(1);
if (!msize) {
msize = 1024;
} else {
msize = parseInt(msize);
}
response.end(Array(msize).join("X"));
}
var server = http.createServer(handle);
server.listen(PORT, function() {});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment