Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-01 15:11:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-01 15:11:46 +0300
commit41876b483a9973c70657941b8d3217a327c1b58a (patch)
tree2e282cabe09bda93a6a38e807a0744169b25720a /lib/gitlab/middleware/compressed_json.rb
parenta67852da7f1243becda660d7619e3f5ccc68c1e1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/middleware/compressed_json.rb')
-rw-r--r--lib/gitlab/middleware/compressed_json.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/gitlab/middleware/compressed_json.rb b/lib/gitlab/middleware/compressed_json.rb
index e2dabca69a8..ef6e0db5673 100644
--- a/lib/gitlab/middleware/compressed_json.rb
+++ b/lib/gitlab/middleware/compressed_json.rb
@@ -27,10 +27,10 @@ module Gitlab
end
def compressed_et_request?(env)
- env['REQUEST_METHOD'] == 'POST' &&
- env['HTTP_CONTENT_ENCODING'] == 'gzip' &&
- env['CONTENT_TYPE'] == 'application/json' &&
- env['PATH_INFO'].start_with?((File.join(relative_url, COLLECTOR_PATH)))
+ post_request?(env) &&
+ gzip_encoding?(env) &&
+ match_content_type?(env) &&
+ match_path?(env)
end
def too_large
@@ -44,6 +44,23 @@ module Gitlab
def extract(input)
Zlib::GzipReader.new(input).read(MAXIMUM_BODY_SIZE + 1)
end
+
+ def post_request?(env)
+ env['REQUEST_METHOD'] == 'POST'
+ end
+
+ def gzip_encoding?(env)
+ env['HTTP_CONTENT_ENCODING'] == 'gzip'
+ end
+
+ def match_content_type?(env)
+ env['CONTENT_TYPE'] == 'application/json' ||
+ env['CONTENT_TYPE'] == 'application/x-sentry-envelope'
+ end
+
+ def match_path?(env)
+ env['PATH_INFO'].start_with?((File.join(relative_url, COLLECTOR_PATH)))
+ end
end
end
end