Skip to content

Commit

Permalink
Merge pull request #1970 from vibe-d/fix_travis
Browse files Browse the repository at this point in the history
Work around Travis-CI IPv6 failures.
  • Loading branch information
s-ludwig authored Nov 5, 2017
2 parents af0c047 + 2bdce62 commit af01069
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion tests/vibe.http.server.1388/dub.sdl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
name "tests"
description "IPv6 request"
dependency "vibe-d:http" path="../../"
versions "VibeDefaultMain"
8 changes: 7 additions & 1 deletion tests/vibe.http.server.1388/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import vibe.stream.operations;
import core.time : msecs;
import std.datetime : Clock, UTC;

shared static this()
void main()
{
version (none) {
auto s1 = new HTTPServerSettings;
s1.bindAddresses = ["::1"];
s1.port = 11388;
Expand All @@ -30,6 +31,11 @@ shared static this()

exitEventLoop();
});
runApplication();
}

import vibe.core.log : logWarn;
logWarn("Test disabled due to issues listening on ::1 on Travis-CI");
}

void handler(scope HTTPServerRequest req, scope HTTPServerResponse res)
Expand Down
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 af01069

Please sign in to comment.