Skip to content

Bug: Valid Content-Type headers ignored in _oauth2_get_source_token_from_post() #72

@roubert

Description

@roubert

The current implementation is too strict, is just looks for a case-insensitve match of the whole string:

(strcasecmp(content_type, OAUTH2_CONTENT_TYPE_FORM_ENCODED) != 0)) {

Where OAUTH2_CONTENT_TYPE_FORM_ENCODED is "application/x-www-form-urlencoded".

But it's perfectly valid to append a ;charset=… parameter to that MIME type and eg. Google Chrome sends this string by default (when no content type is explicitly specified and fetch() is called with a URLSearchParams object as the body):

application/x-www-form-urlencoded;charset=UTF-8

That's a perfectly valid Content-Type header and there's no reason for why liboauth2 shouldn't accept also such headers here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions