Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jochen Bauer
uWebSockets
Commits
f01f5991
Commit
f01f5991
authored
Jan 21, 2018
by
Tamaki Nishino
Committed by
Alex Hultman
Jan 20, 2018
Browse files
Use '> /dev/null 2>&1' redirection (#749)
parent
4926f5f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/main.cpp
View file @
f01f5991
...
...
@@ -828,44 +828,44 @@ void testHTTP() {
FILE
*
nc
;
// invalid data
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"invalid http"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"
\r\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"
\r\n\r
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"
\r
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"
\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET
\r\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET / HTTP/1.1
\r\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET / HTTP/1.1
\r\n
Host: localhost:3000"
,
nc
);
pclose
(
nc
);
// segmented GET
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET /segme"
,
nc
);
fflush
(
nc
);
usleep
(
100000
);
...
...
@@ -884,7 +884,7 @@ void testHTTP() {
pclose
(
nc
);
// segmented upgrade
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET /upgra"
,
nc
);
fflush
(
nc
);
usleep
(
100000
);
...
...
@@ -907,14 +907,14 @@ void testHTTP() {
pclose
(
nc
);
// slow GET should get disconnected
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
sleep
(
3
);
fputs
(
"GET /slowRequest HTTP/1.1
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
// post tests with increading data length
for
(
int
j
=
0
;
j
<
10
;
j
++
)
{
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"POST /postTest HTTP/1.1
\r\n
Content-Length: "
,
nc
);
int
contentLength
=
j
*
1000000
;
...
...
@@ -931,24 +931,24 @@ void testHTTP() {
// todo: two-in-one GET, two-in-one GET, upgrade, etc
// segmented second GET
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET /packedTest HTTP/1.1
\r\n\r\n
GET /packedTest HTTP/"
,
nc
);
fflush
(
nc
);
usleep
(
100000
);
fputs
(
"1.1
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET /packedTest HTTP/1.1
\r\n\r\n
GET /packedTest HTTP/1.1
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
// out of order responses
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"GET /firstRequest HTTP/1.1
\r\n\r\n
GET /secondRequest HTTP/1.1
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
// shutdown
nc
=
popen
(
"nc localhost 3000
&
> /dev/null"
,
"w"
);
nc
=
popen
(
"nc localhost 3000 > /dev/null
2>&1
"
,
"w"
);
fputs
(
"PUT /closeServer HTTP/1.1
\r\n\r\n
"
,
nc
);
pclose
(
nc
);
if
(
expectedRequests
!=
18
)
{
...
...
Write
Preview
Supports
Markdown
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