Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
misc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
misc
Commits
67be2bb0
Commit
67be2bb0
authored
Apr 27, 2016
by
Elvis Pranskevichus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NodeJS HTTP server
parent
17abe9bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
run_benchmarks
run_benchmarks
+6
-0
servers/asyncio_http_server.py
servers/asyncio_http_server.py
+2
-1
servers/nodejs_http_server.js
servers/nodejs_http_server.js
+20
-0
No files found.
run_benchmarks
View file @
67be2bb0
...
@@ -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
,
}]
}]
...
...
servers/asyncio_http_server.py
View file @
67be2bb0
...
@@ -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
):
...
...
servers/nodejs_http_server.js
0 → 100644
View file @
67be2bb0
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
()
{});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment