Skip to content

Built content_type are malformed #2076

@machine424

Description

@machine424

I encountered this while looking into prometheus/prometheus#15777. It appears that a comma (,) is used as a separator in the Content-Type header instead of a semicolon (;).

here:

sinatra/lib/sinatra/base.rb

Lines 399 to 403 in 7b50a1b

mime_type << (mime_type.include?(';') ? ', ' : ';')
mime_type << params.map do |key, val|
val = val.inspect if val =~ /[";,]/
"#{key}=#{val}"
end.join(', ')

All definitions I've seen use a semicolon (;) and apparently the RFC that initially mentioned a comma has since published an errata.

More details here:
https://stackoverflow.com/questions/35761248/which-separator-should-be-used-in-the-content-type-header-for-a-multipart-data-r

Not sure why the other consumers are ok with it, maybe less strict parsing? Do you think this is something that can be adjusted?


By the way, we're looking for someone interested in contributing to the Prometheus Ruby Client, particularly for these changes, it revolves around parsers and content negotiation. Please let me know if you're interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions