Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use non-routable addresses for tests
  • Loading branch information
kraih committed Jun 3, 2012
1 parent 8357a78 commit 33ce157
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions t/mojolicious/lite_app.t
Expand Up @@ -867,29 +867,29 @@ $t->get_ok('/.html')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
->content_is("/root.html\n/root.html\n/root.html\n/root.html\n/root.html\n");

# GET /0 ("X-Forwarded-For")
$t->get_ok('/0', {'X-Forwarded-For' => '192.168.2.2, 192.168.2.1'})
->status_is(200)->content_like(qr!^http\://localhost\:\d+!)
->content_unlike(qr!/0-192\.168\.2\.1-0$!);
$t->get_ok('/0', {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})->status_is(200)
->content_like(qr!^http\://localhost\:\d+/0!)
->content_unlike(qr!-192\.0\.2\.1-0$!);

# GET /0 ("X-Forwarded-HTTPS")
$t->get_ok('/0', {'X-Forwarded-HTTPS' => 1})->status_is(200)
->content_like(qr!^http\://localhost\:\d+!)
->content_unlike(qr!/0-192\.168\.2\.1-0$!);
->content_like(qr!^http\://localhost\:\d+/0!)
->content_unlike(qr!-192\.0\.2\.1-0$!);

# GET /0 (reverse proxy with "X-Forwarded-For")
{
local $ENV{MOJO_REVERSE_PROXY} = 1;
$t->get_ok('/0', {'X-Forwarded-For' => '192.168.2.2, 192.168.2.1'})
$t->get_ok('/0', {'X-Forwarded-For' => '192.0.2.2, 192.0.2.1'})
->status_is(200)
->content_like(qr!http\://localhost\:\d+/0-192\.168\.2\.1-0!);
->content_like(qr!http\://localhost\:\d+/0-192\.0\.2\.1-0$!);
}

# GET /0 (reverse proxy with "X-Forwarded-HTTPS")
{
local $ENV{MOJO_REVERSE_PROXY} = 1;
$t->get_ok('/0', {'X-Forwarded-HTTPS' => 1})->status_is(200)
->content_like(qr!^https\://localhost\:\d+!)
->content_unlike(qr!/0-192\.168\.2\.1-0$!);
->content_like(qr!^https\://localhost\:\d+/0!)
->content_unlike(qr!-192\.0\.2\.1-0$!);
}

# DELETE /inline/epl
Expand Down

0 comments on commit 33ce157

Please sign in to comment.