Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-static
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-static
Commits
e9eeb111
Commit
e9eeb111
authored
Jul 13, 2016
by
Terence Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actually test https with hitting https
parent
ff012e3a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
15 deletions
+33
-15
simple_spec.rb
spec/simple_spec.rb
+12
-5
app_runner.rb
spec/support/app_runner.rb
+12
-5
router_runner.rb
spec/support/router_runner.rb
+9
-5
No files found.
spec/simple_spec.rb
View file @
e9eeb111
...
@@ -118,11 +118,18 @@ RSpec.describe "Simple" do
...
@@ -118,11 +118,18 @@ RSpec.describe "Simple" do
let
(
:name
)
{
"https_only"
}
let
(
:name
)
{
"https_only"
}
it
"should redirect http to https"
do
it
"should redirect http to https"
do
response
=
app
.
get
(
"/foo"
)
app
.
run
do
response
=
app
.
get
(
"/foo.html"
)
expect
(
response
.
code
).
to
eq
(
"301"
)
expect
(
response
.
code
).
to
eq
(
"301"
)
uri
=
URI
(
response
[
'Location'
])
uri
=
URI
(
response
[
'Location'
])
expect
(
uri
.
scheme
).
to
eq
(
"https"
)
expect
(
uri
.
scheme
).
to
eq
(
"https"
)
expect
(
uri
.
path
).
to
eq
(
"/foo"
)
expect
(
uri
.
path
).
to
eq
(
"/foo.html"
)
response
=
app
.
get
(
uri
)
expect
(
response
.
code
).
to
eq
(
"200"
)
expect
(
response
.
body
.
chomp
).
to
eq
(
"foobar"
)
end
end
end
end
end
end
...
...
spec/support/app_runner.rb
View file @
e9eeb111
...
@@ -116,10 +116,17 @@ class AppRunner
...
@@ -116,10 +116,17 @@ class AppRunner
network_retry
(
max_retries
)
do
network_retry
(
max_retries
)
do
uri
=
URI
(
path
)
uri
=
URI
(
path
)
uri
.
host
=
RouterRunner
::
HOST_IP
if
uri
.
host
.
nil?
uri
.
host
=
RouterRunner
::
HOST_IP
if
uri
.
host
.
nil?
uri
.
port
=
RouterRunner
::
HOST_PORT
if
(
uri
.
host
==
RouterRunner
::
HOST_IP
&&
uri
.
port
!=
RouterRunner
::
HOST_PORT
)
||
uri
.
port
.
nil?
uri
.
scheme
=
"http"
if
uri
.
scheme
.
nil?
uri
.
scheme
=
"http"
if
uri
.
scheme
.
nil?
Net
::
HTTP
.
get_response
(
URI
(
uri
.
to_s
))
Net
::
HTTP
.
start
(
uri
.
host
,
uri
.
port
,
use_ssl:
uri
.
scheme
==
"https"
,
verify_mode:
OpenSSL
::
SSL
::
VERIFY_NONE
)
do
|
http
|
request
=
Net
::
HTTP
::
Get
.
new
(
uri
.
to_s
)
http
.
request
(
request
)
end
end
end
end
end
...
...
spec/support/router_runner.rb
View file @
e9eeb111
...
@@ -7,8 +7,8 @@ class RouterRunner < ContainerRunner
...
@@ -7,8 +7,8 @@ class RouterRunner < ContainerRunner
rescue
Errno
::
ENOENT
rescue
Errno
::
ENOENT
end
end
CONTAINER_PORT
=
"80"
HTTP_PORT
=
"80"
H
OST_PORT
=
"80
"
H
TTPS_PORT
=
"443
"
HOST_IP
=
boot2docker_ip
||
"127.0.0.1"
HOST_IP
=
boot2docker_ip
||
"127.0.0.1"
def
initialize
def
initialize
...
@@ -18,9 +18,13 @@ class RouterRunner < ContainerRunner
...
@@ -18,9 +18,13 @@ class RouterRunner < ContainerRunner
"HostConfig"
=>
{
"HostConfig"
=>
{
"Links"
=>
[
"app:app"
],
"Links"
=>
[
"app:app"
],
"PortBindings"
=>
{
"PortBindings"
=>
{
"
#{
CONTAINER
_PORT
}
/tcp"
=>
[{
"
#{
HTTP
_PORT
}
/tcp"
=>
[{
"HostIp"
=>
HOST_IP
,
"HostIp"
=>
HOST_IP
,
"HostPort"
=>
HOST_PORT
,
"HostPort"
=>
HTTP_PORT
}],
"
#{
HTTPS_PORT
}
/tcp"
=>
[{
"HostIp"
=>
HOST_IP
,
"HostPort"
=>
HTTPS_PORT
}]
}]
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment