Skip to content

Commit

Permalink
Use local IPv4 bind address for test cases where it doesn't matter.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Nov 5, 2017
1 parent 618d447 commit 2bdce62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/vibe.http.server.1721/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ shared static this()
{
auto s1 = new HTTPServerSettings;
s1.options &= ~HTTPServerOption.errorStackTraces;
s1.bindAddresses = ["::1"];
s1.bindAddresses = ["127.0.0.1"];
s1.port = 11721;
listenHTTP(s1, &handler);

runTask({
scope (exit) exitEventLoop();

try {
auto conn = connectTCP("::1", 11721);
auto conn = connectTCP("127.0.0.1", 11721);
conn.write("GET / HTTP/1.0\r\n\r\n");
string res = cast(string)conn.readLine();
assert(res == "HTTP/1.0 200 OK", res);
Expand Down
8 changes: 4 additions & 4 deletions tests/vibe.http.server.host-header/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ shared static this()
{
auto s1 = new HTTPServerSettings;
s1.options &= ~HTTPServerOption.errorStackTraces;
s1.bindAddresses = ["::1"];
s1.bindAddresses = ["127.0.0.1"];
s1.port = 11388;
listenHTTP(s1, &handler);

runTask({
try {
auto conn = connectTCP("::1", 11388);
conn.write("GET / HTTP/1.1\r\nHost: [::1]\r\n\r\n");
auto conn = connectTCP("127.0.0.1", 11388);
conn.write("GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n");
string res = cast(string)conn.readLine();
assert(res == "HTTP/1.1 200 OK", res);
while (conn.readLine().length > 0) {}
Expand All @@ -37,7 +37,7 @@ shared static this()
assert(!conn.connected);
logInfo("1.1 without Host header OK.");

conn = connectTCP("::1", 11388);
conn = connectTCP("127.0.0.1", 11388);
conn.write("GET / HTTP/1.0\r\n\r\n");
res = cast(string)conn.readLine();
assert(res == "HTTP/1.0 200 OK", res);
Expand Down

0 comments on commit 2bdce62

Please sign in to comment.