Commit f01f5991 authored by Tamaki Nishino's avatar Tamaki Nishino Committed by Alex Hultman

Use '> /dev/null 2>&1' redirection (#749)

parent 4926f5f5
...@@ -828,44 +828,44 @@ void testHTTP() { ...@@ -828,44 +828,44 @@ void testHTTP() {
FILE *nc; FILE *nc;
// invalid data // invalid data
nc = popen("nc localhost 3000 &> /dev/null", "w"); nc = popen("nc localhost 3000 > /dev/null 2>&1", "w");
fputs("invalid http", nc); fputs("invalid http", nc);
pclose(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); fputs("\r\n\r\n", nc);
pclose(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); fputs("\r\n", nc);
pclose(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); fputs("\r\n\r", nc);
pclose(nc); pclose(nc);
nc = popen("nc localhost 3000 &> /dev/null", "w"); nc = popen("nc localhost 3000 > /dev/null 2>&1", "w");
fputs("\r", nc); fputs("\r", nc);
pclose(nc); pclose(nc);
nc = popen("nc localhost 3000 &> /dev/null", "w"); nc = popen("nc localhost 3000 > /dev/null 2>&1", "w");
fputs("\n", nc); fputs("\n", nc);
pclose(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); fputs("GET \r\n", nc);
pclose(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); fputs("GET / HTTP/1.1\r\n", nc);
pclose(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\nHost: localhost:3000", nc); fputs("GET / HTTP/1.1\r\nHost: localhost:3000", nc);
pclose(nc); pclose(nc);
// segmented GET // segmented GET
nc = popen("nc localhost 3000 &> /dev/null", "w"); nc = popen("nc localhost 3000 > /dev/null 2>&1", "w");
fputs("GET /segme", nc); fputs("GET /segme", nc);
fflush(nc); fflush(nc);
usleep(100000); usleep(100000);
...@@ -884,7 +884,7 @@ void testHTTP() { ...@@ -884,7 +884,7 @@ void testHTTP() {
pclose(nc); pclose(nc);
// segmented upgrade // segmented upgrade
nc = popen("nc localhost 3000 &> /dev/null", "w"); nc = popen("nc localhost 3000 > /dev/null 2>&1", "w");
fputs("GET /upgra", nc); fputs("GET /upgra", nc);
fflush(nc); fflush(nc);
usleep(100000); usleep(100000);
...@@ -907,14 +907,14 @@ void testHTTP() { ...@@ -907,14 +907,14 @@ void testHTTP() {
pclose(nc); pclose(nc);
// slow GET should get disconnected // 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); sleep(3);
fputs("GET /slowRequest HTTP/1.1\r\n\r\n", nc); fputs("GET /slowRequest HTTP/1.1\r\n\r\n", nc);
pclose(nc); pclose(nc);
// post tests with increading data length // post tests with increading data length
for (int j = 0; j < 10; j++) { 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\nContent-Length: ", nc); fputs("POST /postTest HTTP/1.1\r\nContent-Length: ", nc);
int contentLength = j * 1000000; int contentLength = j * 1000000;
...@@ -931,24 +931,24 @@ void testHTTP() { ...@@ -931,24 +931,24 @@ void testHTTP() {
// todo: two-in-one GET, two-in-one GET, upgrade, etc // todo: two-in-one GET, two-in-one GET, upgrade, etc
// segmented second GET // 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\nGET /packedTest HTTP/", nc); fputs("GET /packedTest HTTP/1.1\r\n\r\nGET /packedTest HTTP/", nc);
fflush(nc); fflush(nc);
usleep(100000); usleep(100000);
fputs("1.1\r\n\r\n", nc); fputs("1.1\r\n\r\n", nc);
pclose(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\nGET /packedTest HTTP/1.1\r\n\r\n", nc); fputs("GET /packedTest HTTP/1.1\r\n\r\nGET /packedTest HTTP/1.1\r\n\r\n", nc);
pclose(nc); pclose(nc);
// out of order responses // 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\nGET /secondRequest HTTP/1.1\r\n\r\n", nc); fputs("GET /firstRequest HTTP/1.1\r\n\r\nGET /secondRequest HTTP/1.1\r\n\r\n", nc);
pclose(nc); pclose(nc);
// shutdown // 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); fputs("PUT /closeServer HTTP/1.1\r\n\r\n", nc);
pclose(nc); pclose(nc);
if (expectedRequests != 18) { if (expectedRequests != 18) {
......
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