Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stephane VAROQUI
slapos
Commits
c8ef7db5
Commit
c8ef7db5
authored
Dec 27, 2018
by
Łukasz Nowak
Committed by
Łukasz Nowak
Dec 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature/caddy frontend path normalization
/reviewed-on
nexedi/slapos!487
parent
dddb4d20
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
58 deletions
+121
-58
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+1
-1
software/caddy-frontend/templates/default-virtualhost.conf.in
...ware/caddy-frontend/templates/default-virtualhost.conf.in
+35
-9
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+85
-48
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
c8ef7db5
...
@@ -58,7 +58,7 @@ md5sum = f20d6c3d2d94fb685f8d26dfca1e822b
...
@@ -58,7 +58,7 @@ md5sum = f20d6c3d2d94fb685f8d26dfca1e822b
[template-default-slave-virtualhost]
[template-default-slave-virtualhost]
filename = templates/default-virtualhost.conf.in
filename = templates/default-virtualhost.conf.in
md5sum =
e21bf673c35f049e7457ec78de9a1964
md5sum =
55d0ca695318d7d6111742f4b37fe1b8
[template-cached-slave-virtualhost]
[template-cached-slave-virtualhost]
filename = templates/cached-virtualhost.conf.in
filename = templates/cached-virtualhost.conf.in
...
...
software/caddy-frontend/templates/default-virtualhost.conf.in
View file @
c8ef7db5
...
@@ -42,12 +42,25 @@
...
@@ -42,12 +42,25 @@
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{ slave_parameter.get('error_log') }}
errors {{ slave_parameter.get('error_log') }}
{%- if prefer_gzip and not (slave_type == 'zope' and backend_url) %}
{%- if not (slave_type == 'zope' and backend_url) %}
{% if prefer_gzip %}
rewrite {
rewrite {
regexp (.*)
if {>Accept-Encoding} match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
if {>Accept-Encoding} match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
to /prefer-gzip{uri}
to /prefer-gzip{1}
}
rewrite {
regexp (.*)
if {>Accept-Encoding} not_match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
to {1}
}
}
{%- endif %} {#- if prefer_gzip and not (slave_type == 'zope' and backend_url) #}
{% else %}
rewrite {
regexp (.*)
to {1}
}
{% endif %}
{%- endif %} {#- if not (slave_type == 'zope' and backend_url) #}
{%- if slave_type == 'zope' and backend_url %}
{%- if slave_type == 'zope' and backend_url %}
# Zope configuration
# Zope configuration
...
@@ -105,7 +118,7 @@
...
@@ -105,7 +118,7 @@
{%- elif slave_type == 'redirect' and backend_url %} {#- if slave_type == 'zope' and backend_url #}
{%- elif slave_type == 'redirect' and backend_url %} {#- if slave_type == 'zope' and backend_url #}
# Redirect configuration
# Redirect configuration
redir 302 {
redir 302 {
/ {{ backend_url }}{uri}
/ {{ backend_url }}{
rewrite_
uri}
} {# redir #}
} {# redir #}
{%- else %} {#- if slave_type == 'zope' and backend_url #}
{%- else %} {#- if slave_type == 'zope' and backend_url #}
# Default configuration
# Default configuration
...
@@ -163,20 +176,33 @@
...
@@ -163,20 +176,33 @@
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
log / {{ slave_parameter.get('access_log') }} "{remote} {>REMOTE_USER} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {latency_ms}"
errors {{ slave_parameter.get('error_log') }}
errors {{ slave_parameter.get('error_log') }}
{%- if prefer_gzip and not (slave_type == 'zope' and backend_url) %}
{%- if not (slave_type == 'zope' and backend_url) %}
{%- if prefer_gzip %}
rewrite {
rewrite {
regexp (.*)
if {>Accept-Encoding} match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
if {>Accept-Encoding} match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
to /prefer-gzip{uri}
to /prefer-gzip{1}
}
rewrite {
regexp (.*)
if {>Accept-Encoding} not_match "(^gzip,.*|.*, gzip,.*|.*, gzip$|^gzip$)"
to {1}
}
{% else %}
rewrite {
regexp (.*)
to {1}
}
}
{%- endif %} {#- if prefer_gzip and not (slave_type == 'zope' and backend_url) #}
{% endif %}
{%- endif %} {#- if not (slave_type == 'zope' and backend_url) #}
{%- if https_only %}
{%- if https_only %}
# Enforced redirection to SSL-enabled host
# Enforced redirection to SSL-enabled host
redir / https://{host}{uri}
redir / https://{host}{
rewrite_
uri}
{%- elif slave_type == 'redirect' and slave_parameter.get('url', '') %} {#- if https_only #}
{%- elif slave_type == 'redirect' and slave_parameter.get('url', '') %} {#- if https_only #}
# Redirect configuration
# Redirect configuration
redir 302 {
redir 302 {
/ {{ slave_parameter.get('url', '') }}{uri}
/ {{ slave_parameter.get('url', '') }}{
rewrite_
uri}
} {# redir #}
} {# redir #}
{%- elif slave_type == 'zope' and backend_url %} {#- if https_only #}
{%- elif slave_type == 'zope' and backend_url %} {#- if https_only #}
# Zope configuration
# Zope configuration
...
...
software/caddy-frontend/test/test.py
View file @
c8ef7db5
...
@@ -1161,13 +1161,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1161,13 +1161,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
try:
try:
j = result.json()
j = result.json()
...
@@ -1186,8 +1187,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1186,8 +1187,9 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result_http = self.fakeHTTPResult(
result_http = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
self.assertEqualResultJson(result_http, '
Path
', '
/
test
-
path
')
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqualResultJson(result_http, '
Path
', '
/
test
-
path
/
deeper
')
try:
try:
j = result_http.json()
j = result_http.json()
...
@@ -1252,7 +1254,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1252,7 +1254,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
...
@@ -1262,7 +1265,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1262,7 +1265,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
result,
result,
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
https
//
'
'
/
VirtualHostBase
/
https
//
'
'
typezopepath
.
example
.
com
:
443
/
path
/
VirtualHostRoot
/
test
-
path
'
'
typezopepath
.
example
.
com
:
443
/
path
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
def test_type_zope_default_path(self):
def test_type_zope_default_path(self):
...
@@ -1309,25 +1312,28 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1309,25 +1312,28 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
'
alias1
.
example
.
com
', parameter_dict['
public
-
ipv4
'], '
test
-
path
')
'
alias1
.
example
.
com
', parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
'
alias2
.
example
.
com
', parameter_dict['
public
-
ipv4
'], '
test
-
path
')
'
alias2
.
example
.
com
', parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
...
@@ -1525,19 +1531,21 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1525,19 +1531,21 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
result_http = self.fakeHTTPResult(
result_http = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
'
https
:
//
httpsonly
.
example
.
com
/
test
-
path
',
'
https
:
//
httpsonly
.
example
.
com
/
test
-
path
/
deeper
',
result_http.headers['
Location
']
result_http.headers['
Location
']
)
)
...
@@ -1631,7 +1639,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1631,7 +1639,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
...
@@ -1647,17 +1656,18 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1647,17 +1656,18 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
result,
result,
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
https
//
typezope
.
example
.
com
:
443
/
'
'
/
VirtualHostBase
/
https
//
typezope
.
example
.
com
:
443
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
result = self.fakeHTTPResult(
result = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqualResultJson(
self.assertEqualResultJson(
result,
result,
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
http
//
typezope
.
example
.
com
:
80
/
'
'
/
VirtualHostBase
/
http
//
typezope
.
example
.
com
:
80
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
def test_type_zope_prefer_gzip_encoding_to_backend(self):
def test_type_zope_prefer_gzip_encoding_to_backend(self):
...
@@ -1678,7 +1688,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1678,7 +1688,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
...
@@ -1695,22 +1706,24 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1695,22 +1706,24 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
https
//
'
'
/
VirtualHostBase
/
https
//
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
443
/
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
443
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
result = self.fakeHTTPResult(
result = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqualResultJson(
self.assertEqualResultJson(
result,
result,
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
http
//
'
'
/
VirtualHostBase
/
http
//
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
80
/
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
80
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
',
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
',
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
self.assertEqual(
self.assertEqual(
...
@@ -1728,13 +1741,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1728,13 +1741,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
https
//
'
'
/
VirtualHostBase
/
https
//
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
443
/
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
443
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
self.assertEqual(
self.assertEqual(
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
result = self.fakeHTTPResult(
result = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
',
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
',
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
self.assertEqualResultJson(
self.assertEqualResultJson(
...
@@ -1742,7 +1756,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1742,7 +1756,7 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'
Path
',
'
Path
',
'
/
VirtualHostBase
/
http
//
'
'
/
VirtualHostBase
/
http
//
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
80
/
'
'
typezopeprefergzipencodingtobackend
.
example
.
com
:
80
/
'
'
/
VirtualHostRoot
/
test
-
path
'
'
/
VirtualHostRoot
/
test
-
path
/
deeper
'
)
)
self.assertEqual(
self.assertEqual(
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
...
@@ -1821,7 +1835,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1821,7 +1835,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
',
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
',
NGINX_HTTPS_PORT)
NGINX_HTTPS_PORT)
self.assertEqual(
self.assertEqual(
...
@@ -1830,6 +1845,17 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1830,6 +1845,17 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
/
terminals
/
websocket
/
test
',
NGINX_HTTPS_PORT)
self.assertEqual(
self.certificate_pem,
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
terminals
/
websocket
')
@skip('
Feature
postponed
')
@skip('
Feature
postponed
')
def test_type_websocket(self):
def test_type_websocket(self):
# Pure websocket configurable frontend
# Pure websocket configurable frontend
...
@@ -1903,14 +1929,15 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -1903,14 +1929,15 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqual(
self.assertEqual(
'
%
s
/
test
-
path
' % (self.backend_url,),
'
%
s
/
test
-
path
/
deeper
' % (self.backend_url,),
result.headers['
Location
']
result.headers['
Location
']
)
)
...
@@ -2066,7 +2093,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2066,7 +2093,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
...
@@ -2078,7 +2106,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2078,7 +2106,8 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result_http = self.fakeHTTPResult(
result_http = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deeper
')
self.assertEqual(
self.assertEqual(
httplib.BAD_GATEWAY,
httplib.BAD_GATEWAY,
...
@@ -2105,13 +2134,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2105,13 +2134,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
headers = result.headers.copy()
headers = result.headers.copy()
...
@@ -2472,13 +2502,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2472,13 +2502,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
headers = result.headers.copy()
headers = result.headers.copy()
...
@@ -2760,40 +2791,44 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -2760,40 +2791,44 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
',
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
',
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
headers={'
Accept
-
Encoding
': '
gzip
,
deflate
'})
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
self.assertEqual(
self.assertEqual(
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
'
gzip
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
',
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
',
headers={'
Accept
-
Encoding
': '
deflate
'})
headers={'
Accept
-
Encoding
': '
deflate
'})
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
self.assertEqual(
self.assertEqual(
'
deflate
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
'
deflate
', result.json()['
Incoming
Headers
']['
accept
-
encoding
'])
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
test
-
path
/
deeper
')
def test_disabled_cookie_list(self):
def test_disabled_cookie_list(self):
parameter_dict = self.parseSlaveParameterDict('
disabled
-
cookie
-
list
')
parameter_dict = self.parseSlaveParameterDict('
disabled
-
cookie
-
list
')
...
@@ -3018,17 +3053,19 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
...
@@ -3018,17 +3053,19 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
)
)
result = self.fakeHTTPSResult(
result = self.fakeHTTPSResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqual(
self.assertEqual(
self.certificate_pem,
self.certificate_pem,
der2pem(result.peercert))
der2pem(result.peercert))
self.assertEqualResultJson(result, '
Path
', '
/
https
/
test
-
path
')
self.assertEqualResultJson(result, '
Path
', '
/
https
/
test
-
path
/
deeper
')
result_http = self.fakeHTTPResult(
result_http = self.fakeHTTPResult(
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'], '
test
-
path
')
parameter_dict['
domain
'], parameter_dict['
public
-
ipv4
'],
self.assertEqualResultJson(result_http, '
Path
', '
/
http
/
test
-
path
')
'
test
-
path
/
deep
/
..
/
.
/
deeper
')
self.assertEqualResultJson(result_http, '
Path
', '
/
http
/
test
-
path
/
deeper
')
class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin):
...
...
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