2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-25 16:15:39 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
2018-03-25 17:30:42 +00:00
|
|
|
require 'rails_helper'
|
2019-07-30 21:29:24 +00:00
|
|
|
require 'rack/ssl'
|
2018-03-25 17:30:42 +00:00
|
|
|
describe Rack::SSL do
|
|
|
|
describe '.call' do
|
2019-07-30 21:29:24 +00:00
|
|
|
it 'invalid uri returns 404' do
|
2018-03-25 17:30:42 +00:00
|
|
|
def test_invalid_uri_returns_404
|
|
|
|
# Can't test this with Rack::Test because it fails on the URI before it
|
|
|
|
# even gets to Rack::SSL. Other webservers will pass this URI through.
|
|
|
|
ssl = Rack::SSL.new(nil)
|
2019-07-30 21:29:24 +00:00
|
|
|
resp = ssl.call('PATH_INFO' => 'https://example.org/path/<script>')
|
2018-03-25 17:30:42 +00:00
|
|
|
expect(resp[0]).to eq 404
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|