]> git.openstreetmap.org Git - rails.git/commitdiff
Drop the old output_compression plugin
authorTom Hughes <tom@compton.nu>
Sun, 1 Mar 2015 10:48:10 +0000 (10:48 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 1 Mar 2015 10:52:28 +0000 (10:52 +0000)
The production servers all have mod_deflate enabled anyway, which
almost certainly does a better job of compression than this.

12 files changed:
app/controllers/api_controller.rb
app/controllers/changeset_controller.rb
app/controllers/node_controller.rb
app/controllers/notes_controller.rb
app/controllers/old_controller.rb
app/controllers/relation_controller.rb
app/controllers/search_controller.rb
app/controllers/way_controller.rb
config/initializers/output_compression.rb [deleted file]
lib/output_compression/LICENSE [deleted file]
lib/output_compression/README [deleted file]
lib/output_compression/output_compression.rb [deleted file]

index 7bf8f0499c7339b41a6c908aadde98e978b02325..caa2df9d81f622e92c4b0f01656968e91579bb3b 100644 (file)
@@ -2,7 +2,6 @@ class ApiController < ApplicationController
   skip_before_action :verify_authenticity_token
   before_action :check_api_readable, :except => [:capabilities]
   before_action :setup_user_auth, :only => [:permissions]
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
 
   # Get an XML response containing a list of tracepoints that have been uploaded
index d2740f7f33e13aa3c89605e546535fa0d69b7d16..2a8fec95e775cf0ec024216c17256c0ff8210fb5 100644 (file)
@@ -14,7 +14,6 @@ class ChangesetController < ApplicationController
   before_action :check_api_writable, :only => [:create, :update, :delete, :upload, :include, :comment, :subscribe, :unsubscribe, :hide_comment, :unhide_comment]
   before_action :check_api_readable, :except => [:create, :update, :delete, :upload, :download, :query, :list, :feed, :comment, :subscribe, :unsubscribe, :comments_feed]
   before_action(:only => [:list, :feed, :comments_feed]) { |c| c.check_database_readable(true) }
-  after_action :compress_output
   around_action :api_call_handle_error, :except => [:list, :feed, :comments_feed]
   around_action :web_timeout, :only => [:list, :feed, :comments_feed]
 
index 9d3825679c5425629c5cd76e1d2675e90e6c92bc..4880c46be91cd8ee9342d115cd6c5bb25cbfb7b9 100644 (file)
@@ -9,7 +9,6 @@ class NodeController < ApplicationController
   before_action :require_public_data, :only => [:create, :update, :delete]
   before_action :check_api_writable, :only => [:create, :update, :delete]
   before_action :check_api_readable, :except => [:create, :update, :delete]
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
 
   # Create a node from XML.
index 5ae136f29aac5c8ce3548cfb232e0d8ea761eb69..f1ac6baa8c4ec681a6c57fa691c548fbff827a1a 100644 (file)
@@ -9,7 +9,6 @@ class NotesController < ApplicationController
   before_action :check_api_writable, :only => [:create, :comment, :close, :reopen, :destroy]
   before_action :require_allow_write_notes, :only => [:create, :comment, :close, :reopen, :destroy]
   before_action :set_locale
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
 
   ##
index b52c4efa4c40f7dd12718d767b7cee1ba68d2c4f..9e1137f8d6e635cd7d1b001167701689fc9a1de9 100644 (file)
@@ -11,7 +11,6 @@ class OldController < ApplicationController
   before_action :require_allow_write_api, :only => [:redact]
   before_action :check_api_readable
   before_action :check_api_writable, :only => [:redact]
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
   before_action :lookup_old_element, :except => [:history]
   before_action :lookup_old_element_versions, :only => [:history]
index 63fdafbde355b386a6ad740c65e0eb87504a4957..42b8c7036ee1d81f808572c1760fce1aeff2e4b3 100644 (file)
@@ -7,7 +7,6 @@ class RelationController < ApplicationController
   before_action :require_public_data, :only => [:create, :update, :delete]
   before_action :check_api_writable, :only => [:create, :update, :delete]
   before_action :check_api_readable, :except => [:create, :update, :delete]
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
 
   def create
index 6e9130a526f6e90340747dde82dc6de05d8923e8..8a632e6a2c2cebd9526afec79371a91cddc6e0fb 100644 (file)
@@ -3,7 +3,6 @@ class SearchController < ApplicationController
   # Can search by tag k, v, or both (type->k,value->v)
   # Can search by name (k=name,v=....)
   skip_before_action :verify_authenticity_token
-  after_action :compress_output
 
   def search_all
     do_search(true, true, true)
index 0e98854ef76268cf11d473db635f1d2abecec678..dd9b65fd87de89316119f6e0592a212342020bad 100644 (file)
@@ -7,7 +7,6 @@ class WayController < ApplicationController
   before_action :require_public_data, :only => [:create, :update, :delete]
   before_action :check_api_writable, :only => [:create, :update, :delete]
   before_action :check_api_readable, :except => [:create, :update, :delete]
-  after_action :compress_output
   around_action :api_call_handle_error, :api_call_timeout
 
   def create
diff --git a/config/initializers/output_compression.rb b/config/initializers/output_compression.rb
deleted file mode 100644 (file)
index ab24631..0000000
+++ /dev/null
@@ -1 +0,0 @@
-require "output_compression/output_compression"
diff --git a/lib/output_compression/LICENSE b/lib/output_compression/LICENSE
deleted file mode 100644 (file)
index 1139144..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2004-2007 Jeremy Evans
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights 
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
-copies of the Software, and to permit persons to whom the Software is 
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in 
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
-SOFTWARE.
diff --git a/lib/output_compression/README b/lib/output_compression/README
deleted file mode 100644 (file)
index 54030bf..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-OutputCompression
-=================
-
-Allows gzip output compression to clients that support it. Simple to use, just
-put after_filter :compress_output in your controller. Pulled out of the Google
-cache and packaged into plugin form, code originally hosted at
-http://www.tuxsoft.se/oss/rails/download/output_compression.rb.
-
-    svn: svn://code.jeremyevans.net/rails/plugins/output_compression
-    file: http://code.jeremyevans.net/code/output_compression.tar.gz
diff --git a/lib/output_compression/output_compression.rb b/lib/output_compression/output_compression.rb
deleted file mode 100644 (file)
index fc80d68..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# OutputCompression
-# Rails output compression filters
-#
-# Adds two classmethods to ActionController that can be used as after-filters:
-# strip_whitespace and compress_output.
-# If you use page-caching, you MUST specify the compress_output filter AFTER
-# caches_page, otherwise the compressed data will be cached instead of the HTML
-#
-# class MyController < ApplicationController
-#  after_filter :strip_whitespace
-#  caches_page :index
-#  after_filter :compress_output
-# end
-
-begin
-  require "zlib"
-  require "stringio"
-  GZIP_SUPPORTED = true
-rescue
-  GZIP_SUPPORTED = false
-end
-
-module CompressionSystem
-  def compress_output
-    return unless accepts_gzip?
-    output = StringIO.new
-    def output.close
-      # Zlib does a close. Bad Zlib...
-      rewind
-    end
-    gz = Zlib::GzipWriter.new(output)
-    gz.write(response.body)
-    gz.close
-    if output.length < response.body.length
-      @old_response_body = response.body
-      response.body = output.string
-      response.headers["Content-encoding"] = @compression_encoding
-    end
-  end
-
-  def accepts_gzip?
-    return false unless GZIP_SUPPORTED
-    accepts = request.env["HTTP_ACCEPT_ENCODING"]
-    return false unless accepts && accepts =~ /(x-gzip|gzip)/
-    @compression_encoding = $1
-    true
-  end
-
-  def strip_whitespace
-    response.body.gsub!(/()|(.*?<\/script>)|()|()|\s+/m) do |m|
-      if m =~ /^()(.*?)<\/script>$/m
-        $1 + $2.strip.gsub(/\s+/, " ").gsub("", "\n-->") + ""
-      elsif m =~ /^$/m
-        ""
-      elsif m =~ /^<(textarea|pre)/
-        m
-      else " "
-      end
-    end
-    response.body.gsub! /\s+\s+/, ">"
-  end
-end
-
-module ActionController
-  class Base
-    include CompressionSystem
-  end
-end