diff options
Diffstat (limited to 'test/test_ssl.rb')
-rw-r--r-- | test/test_ssl.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_ssl.rb b/test/test_ssl.rb index 5fc2b52..e89a89d 100644 --- a/test/test_ssl.rb +++ b/test/test_ssl.rb @@ -114,11 +114,25 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC assert_match %r{\AHTTP/1\.\d 200 OK\r\n}, head end + # use port in Host: header (implemented by unicorn_http parser) + exp = '666' + client.write("GET /SERVER_PORT HTTP/1.1\r\nHost: example.com:#{exp}\r\n\r\n") + re = /#{Regexp.escape(exp)}\z/ + buf.clear + Timeout.timeout(60) do + buf << client.readpartial(111) until buf =~ re + end + head, body = buf.split("\r\n\r\n", 2) + assert_equal exp, body + assert_match %r{\AHTTP/1\.\d 200 OK\r\n}, head + Net::HTTP.start(insecure.addr[3], insecure.addr[1]) do |h| res = h.get('/rack.url_scheme') assert_equal 'http', res.body res = h.get('/HTTPS') assert_equal 'nil', res.body + res = h.get('/SERVER_PORT') + assert_equal insecure.addr[1].to_s, res.body end # read static file |