Skip to content

Does not abide by Rack SPEC #4

@qortex

Description

@qortex

Rack::Lint enforces SPEC:

      ## The CGI keys (named without a period) must have String values.
      ## If the string values for CGI keys contain non-ASCII characters,
      ## they should use ASCII-8BIT encoding.
      env.each { |key, value|
        next  if key.include? "."   # Skip extensions
        assert("env variable #{key} has non-string value #{value.inspect}") {
          value.kind_of? String
        }
        next if value.encoding == Encoding::ASCII_8BIT
        assert("env variable #{key} has value containing non-ASCII characters and has non-ASCII-8BIT encoding #{value.inspect} encoding: #{value.encoding}") {
          value.b !~ /[\x80-\xff]/n
        }
      }

Thus, enabling Rack::Lint middleware generates an exception:

Rack::Lint::LintError: env variable parsed_body has non-string value

The CGI keys (named without a period) must have String values. suggests a fix would be to rename it to body_parser.document or something like that, to abide by the convention. Although of course it would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions