From: Eric Wong <e@80x24.org> To: yahns-public@yhbt.net Subject: [PATCH 2/1] test_ssl: check SERVER_PORT when parsed from Host: header Date: Sat, 20 Feb 2016 21:44:54 +0000 [thread overview] Message-ID: <20160220214454.GA23169@dcvr.yhbt.net> (raw) In-Reply-To: <20160220033356.GA31676@dcvr.yhbt.net> We need to ensure SERVER_PORT is still parsed from the Host: header when it is given, there. --- test/test_ssl.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 @@ def test_ssl_basic 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 -- EW
prev parent reply other threads:[~2016-02-20 21:44 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-20 3:33 [PATCH] https: ensure SERVER_PORT defaults to 443 Eric Wong 2016-02-20 21:44 ` Eric Wong [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://yhbt.net/yahns/README * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160220214454.GA23169@dcvr.yhbt.net \ --to=e@80x24.org \ --cc=yahns-public@yhbt.net \ --subject='Re: [PATCH 2/1] test_ssl: check SERVER_PORT when parsed from Host: header' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: ../../yahns.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).