Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active June 9, 2018 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/471d8aaf099d13bdcb928324346a946f to your computer and use it in GitHub Desktop.
Save zunda/471d8aaf099d13bdcb928324346a946f to your computer and use it in GitHub Desktop.
Rack::Deflaterはruby-2.6.0preview2でも空のレスポンスボディを返してくるのだった
$ rbenv local 2.6.0-preview2
$ cat <<_END > Gemfile
source 'https://rubygems.org'
gem 'rails'
_END
$ bundle install --path=vendor/bundle
$ bundle exec rails new .
$ bundle exec rails s
$ mv config/application.rb config/application.rb.orig
$ cp config/application.rb.orig config/application.rb
$ vi config/application.rb
$ diff -u config/application.rb{.orig,}
--- config/application.rb.orig 2018-06-08 20:56:01.000000000 -1000
+++ config/application.rb 2018-06-08 20:59:13.000000000 -1000
@@ -15,5 +15,7 @@
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
+
+ config.middleware.use Rack::Deflater
end
end
$ bundle exec ruby --version
ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-darwin17]
$ bundle exec rails s
$ curl -H 'Accept-Encoding: gzip' http://localhost:3000/
(なにもなーい)
$ curl -v -H 'Accept-Encoding: gzip' http://localhost:3000/
* Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 3000 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.54.0
> Accept: */*
> Accept-Encoding: gzip
>
< HTTP/1.1 200 OK
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Referrer-Policy: strict-origin-when-cross-origin
< Content-Type: text/html; charset=utf-8
< Vary: Accept-Encoding
< Content-Encoding: gzip
< ETag: W/"08e152a4a8f0f39fc95edcb5febf9901"
< Cache-Control: max-age=0, private, must-revalidate
< Content-Security-Policy: script-src 'unsafe-inline'; style-src 'unsafe-inline'
< X-Request-Id: 7b71ab0f-d250-4a7c-8c62-632d088b69b4
< X-Runtime: 0.148681
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment