Class: Gitlab::Middleware::HandleMalformedStrings
- Inherits:
-
Object
- Object
- Gitlab::Middleware::HandleMalformedStrings
- Includes:
- ActionController::HttpAuthentication::Basic
- Defined in:
- lib/gitlab/middleware/handle_malformed_strings.rb
Overview
There is no valid reason for a request to contain a malformed string so just return HTTP 400 (Bad Request) if we receive one
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ HandleMalformedStrings
constructor
A new instance of HandleMalformedStrings.
Constructor Details
#initialize(app) ⇒ HandleMalformedStrings
Returns a new instance of HandleMalformedStrings.
12 13 14 |
# File 'lib/gitlab/middleware/handle_malformed_strings.rb', line 12 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
10 11 12 |
# File 'lib/gitlab/middleware/handle_malformed_strings.rb', line 10 def app @app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 |
# File 'lib/gitlab/middleware/handle_malformed_strings.rb', line 16 def call(env) return [400, { 'Content-Type' => 'text/plain' }, ['Bad Request']] if request_contains_malformed_string?(env) app.call(env) end |