about summary refs log tree commit homepage
path: root/lib/upr/json.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/upr/json.rb')
-rw-r--r--lib/upr/json.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/upr/json.rb b/lib/upr/json.rb
index 6c03b6b..9f78d54 100644
--- a/lib/upr/json.rb
+++ b/lib/upr/json.rb
@@ -19,9 +19,13 @@ module Upr
 
     SLEEP_CLASS = defined?(Actor) ? Actor : Kernel
 
-    RESP_HEADERS = {
+    # our default response headers, we need to set no-transform to
+    # prevent deflaters from compressing our already-small small input
+    # and also to prevent buffering/corking of the response inside
+    # deflater buffers.
+    RESPONSE_HEADERS = {
       'Content-Type' => 'application/json',
-      'Cache-Control' => 'no-cache',
+      'Cache-Control' => 'no-cache, no-transform',
     }
 
     def initialize(options = {})
@@ -82,7 +86,7 @@ module Upr
       if uid = extract_upload_id(env)
         _wrap(env, uid)
       else
-        [ 400, RESP_HEADERS.dup, [ _error_msg("upload_id not given") ] ]
+        [ 400, RESPONSE_HEADERS.dup, [ _error_msg("upload_id not given") ] ]
       end
     end
 
@@ -116,7 +120,7 @@ module Upr
     def _wrap(env, uid)
       _self = dup
       _self.upload_id = uid
-      [ 200, RESP_HEADERS.dup, _self ]
+      [ 200, RESPONSE_HEADERS.dup, _self ]
     end
 
     def _error_msg(msg)