Skip to content

Does protocol casing affect the URL parsing? #32

Description

@armanm

I don't know enough about URL parsing to know if this is the correct behaviour but here is a test case:

const URL = require('url')

URL.parse('javascript:ALERT(DOCUMENT.DOMAIN)').href
// => 'javascript:ALERT(DOCUMENT.DOMAIN)'

URL.parse('JAVASCRIPT:ALERT(DOCUMENT.DOMAIN)').href
// => 'javascript:alert/(DOCUMENT.DOMAIN)'

As you can see in the latter example when protocol is specified in upper case, the href ends up partly lowercased and with an extra slash.

Could someone explain if this is a bug or a correct behaviour?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions