about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2018-05-10 21:36:12 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-05-10 14:36:12 +0200
commit6588f6a0a9118e6feb2f23d82655b2435c6cbbca (patch)
tree14a6a97dde5f5ae2eb2c05b80d4e97c8d7807244
parentac788ad47e32a3cf84a46ac87f84f376185cdad4 (diff)
Disable inflate gzip on head method (#7432)
-rw-r--r--app/lib/request.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/lib/request.rb b/app/lib/request.rb
index fc7d398e0..731bf7687 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -51,16 +51,17 @@ class Request
   end
 
   def headers
-    (@account ? @headers.merge('Signature' => signature) : @headers).reverse_merge('Accept-Encoding' => 'gzip').without(REQUEST_TARGET)
+    (@account ? @headers.merge('Signature' => signature) : @headers).without(REQUEST_TARGET)
   end
 
   private
 
   def set_common_headers!
-    @headers[REQUEST_TARGET] = "#{@verb} #{@url.path}"
-    @headers['User-Agent']   = user_agent
-    @headers['Host']         = @url.host
-    @headers['Date']         = Time.now.utc.httpdate
+    @headers[REQUEST_TARGET]    = "#{@verb} #{@url.path}"
+    @headers['User-Agent']      = user_agent
+    @headers['Host']            = @url.host
+    @headers['Date']            = Time.now.utc.httpdate
+    @headers['Accept-Encoding'] = 'gzip' if @verb != :head
   end
 
   def set_digest!