mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Also skip Content-Encoding and Vary header if 304
This commit is contained in:
parent
d4103fc232
commit
b60c1fe97b
2 changed files with 6 additions and 4 deletions
|
@ -47,10 +47,11 @@ module ActionDispatch
|
||||||
if gzip_path && gzip_encoding_accepted?(env)
|
if gzip_path && gzip_encoding_accepted?(env)
|
||||||
env['PATH_INFO'] = gzip_path
|
env['PATH_INFO'] = gzip_path
|
||||||
status, headers, body = @file_server.call(env)
|
status, headers, body = @file_server.call(env)
|
||||||
headers['Content-Encoding'] = 'gzip'
|
if status == 304
|
||||||
if status != 304
|
return [status, headers, body]
|
||||||
headers['Content-Type'] = content_type(path)
|
|
||||||
end
|
end
|
||||||
|
headers['Content-Encoding'] = 'gzip'
|
||||||
|
headers['Content-Type'] = content_type(path)
|
||||||
else
|
else
|
||||||
status, headers, body = @file_server.call(env)
|
status, headers, body = @file_server.call(env)
|
||||||
end
|
end
|
||||||
|
|
|
@ -149,7 +149,8 @@ module StaticTests
|
||||||
response = get(file_name, 'HTTP_ACCEPT_ENCODING' => 'gzip', 'HTTP_IF_MODIFIED_SINCE' => last_modified.httpdate)
|
response = get(file_name, 'HTTP_ACCEPT_ENCODING' => 'gzip', 'HTTP_IF_MODIFIED_SINCE' => last_modified.httpdate)
|
||||||
assert_equal 304, response.status
|
assert_equal 304, response.status
|
||||||
assert_equal nil, response.headers['Content-Type']
|
assert_equal nil, response.headers['Content-Type']
|
||||||
assert_equal 'gzip', response.headers['Content-Encoding']
|
assert_equal nil, response.headers['Content-Encoding']
|
||||||
|
assert_equal nil, response.headers['Vary']
|
||||||
end
|
end
|
||||||
|
|
||||||
# Windows doesn't allow \ / : * ? " < > | in filenames
|
# Windows doesn't allow \ / : * ? " < > | in filenames
|
||||||
|
|
Loading…
Reference in a new issue