-
-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add all gzip params for http context #367
Changes from all commits
7678b4c
430e5b2
6f1d056
8110050
bc2e9c6
8e84a98
10ff647
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,60 @@ | |
:value => '123', | ||
:match => ' keepalive_timeout 123;', | ||
}, | ||
{ | ||
:title => 'should set gzip', | ||
:attr => 'gzip', | ||
:value => 'on', | ||
:match => ' gzip on;', | ||
}, | ||
{ | ||
:title => 'should set gzip_buffers', | ||
:attr => 'gzip_buffers', | ||
:value => '32 4k', | ||
:match => ' gzip_buffers 32 4k;', | ||
}, | ||
{ | ||
:title => 'should set gzip_comp_level', | ||
:attr => 'gzip_comp_level', | ||
:value => '1', | ||
:match => ' gzip_comp_level 1;', | ||
}, | ||
{ | ||
:title => 'should set gzip_disable', | ||
:attr => 'gzip_disable', | ||
:value => 'MSIE [1-6]\.(?!.*SV1)', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should test with a value different from the default to make sure it's being passed through correctly. |
||
:match => ' gzip_disable MSIE [1-6]\.(?!.*SV1);', | ||
}, | ||
{ | ||
:title => 'should set gzip_min_length', | ||
:attr => 'gzip_min_length', | ||
:value => '20', | ||
:match => ' gzip_min_length 20;', | ||
}, | ||
{ | ||
:title => 'should set gzip_http_version', | ||
:attr => 'gzip_http_version', | ||
:value => '1.1', | ||
:match => ' gzip_http_version 1.1;', | ||
}, | ||
{ | ||
:title => 'should set gzip_proxied', | ||
:attr => 'gzip_proxied', | ||
:value => 'any', | ||
:match => ' gzip_proxied any;', | ||
}, | ||
{ | ||
:title => 'should set gzip_types', | ||
:attr => 'gzip_types', | ||
:value => ['text/plain','text/html'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get another test where |
||
:match => ' gzip_types text/plain text/html;', | ||
}, | ||
{ | ||
:title => 'should set gzip_vary', | ||
:attr => 'gzip_vary', | ||
:value => 'on', | ||
:match => ' gzip_vary on;', | ||
} | ||
].each do |param| | ||
context "when #{param[:attr]} is #{param[:value]}" do | ||
let :params do { param[:attr].to_sym => param[:value] } end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,8 +44,29 @@ http { | |
tcp_nodelay <%= @http_tcp_nodelay %>; | ||
|
||
<% if @gzip == 'on' -%> | ||
gzip on; | ||
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | ||
gzip on; | ||
<% if @gzip_buffers -%> | ||
gzip_buffers <%= @gzip_buffers %>; | ||
<% end -%> | ||
<% if @gzip_comp_level -%> | ||
gzip_comp_level <%= @gzip_comp_level %>; | ||
<% end -%> | ||
gzip_disable <%= @gzip_disable %>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be conditional like the rest so that setting to |
||
<% if @gzip_min_length -%> | ||
gzip_min_length <%= @gzip_min_length %>; | ||
<% end -%> | ||
<% if @gzip_http_version -%> | ||
gzip_http_version <%= @gzip_http_version %>; | ||
<% end -%> | ||
<% if @gzip_proxied -%> | ||
gzip_proxied <%= @gzip_proxied %>; | ||
<% end -%> | ||
<% if @gzip_types -%> | ||
gzip_types <%= @gzip_types.kind_of?(Array) ? @gzip_types.join(' ') : @gzip_types %>; | ||
<% end -%> | ||
<% if @gzip_vary -%> | ||
gzip_vary <%= @gzip_vary %>; | ||
<% end -%> | ||
<% end -%> | ||
|
||
<% if @proxy_cache_path -%> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a negative test as well? use
:value => 'off'
and:notmatch => /gzip/
This should be applied to the rest of the parameters too.