Sha256: 893c8aa24c081b8290f32d62e4e49d2b28b89674f40347dc2f190f4471da8b2b

Contents?: true

Size: 1.07 KB

Versions: 48

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require "abstract_unit"

class IPv6IntegrationTest < ActionDispatch::IntegrationTest
  Routes = ActionDispatch::Routing::RouteSet.new
  include Routes.url_helpers

  class ::BadRouteRequestController < ActionController::Base
    include Routes.url_helpers
    def index
      render plain: foo_path
    end

    def foo
      redirect_to action: :index
    end
  end

  Routes.draw do
    get "/",    to: "bad_route_request#index", as: :index
    get "/foo", to: "bad_route_request#foo", as: :foo
  end

  def _routes
    Routes
  end

  APP = build_app Routes
  def app
    APP
  end

  test "bad IPv6 redirection" do
    #   def test_simple_redirect
    request_env = {
      "REMOTE_ADDR" => "fd07:2fa:6cff:2112:225:90ff:fec7:22aa",
      "HTTP_HOST"   => "[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000",
      "SERVER_NAME" => "[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]",
      "SERVER_PORT" => 3000 }

    get "/foo", env: request_env
    assert_response :redirect
    assert_equal "http://[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000/", redirect_to_url
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
jets-1.9.7 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.6 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.5 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.4 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.3 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.2 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.1 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.9.0 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.14 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.13 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.12 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.11 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.10 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.9 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.8 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.7 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.6 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.5 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.4 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb
jets-1.8.3 vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb