GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs: state behavior for url pathname and percent encoding · Issue #1538 · nodejs/node

docs: state behavior for url pathname and percent encoding #1538

New issue
Copy link
New issue
Copy link
Closed
Closed
docs: state behavior for url pathname and percent encoding#1538
Copy link
Labels
docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.urlIssues and PRs related to the legacy built-in url module.

Description

@gopat
gopat
opened on Apr 27, 2015
Issue body actions

Shouldn't be stated in the docs that url module does NOT touch pathname or pathname part of path (no percent encoding/decoding) when extracting-from/putting-into urls?

> url.parse('https://example.com/pathname%20with%20fun%20incorporated%3d/?adf=f4&er4=%40',false);
{ protocol: 'https:',
  slashes: true,
  auth: null,
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: null,
  search: '?adf=f4&er4=%40',
  query: 'adf=f4&er4=%40',
  pathname: '/pathname%20with%20fun%20incorporated%3d/',
  path: '/pathname%20with%20fun%20incorporated%3d/?adf=f4&er4=%40',
  href: 'https://example.com/pathname%20with%20fun%20incorporated%3d/?adf=f4&er4=%40' }

> url.parse('https://example.com/pathname%20with%20fun%20incorporated%3d/?adf=f4&er4=%40',true);
{ protocol: 'https:',
  slashes: true,
  auth: null,
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: null,
  search: '?adf=f4&er4=%40',
  query: { adf: 'f4', er4: '@' },
  pathname: '/pathname%20with%20fun%20incorporated%3d/',
  path: '/pathname%20with%20fun%20incorporated?adf=f4&er4=%40',
  href: 'https://example.com/pathname%20with%20fun%20incorporated?adf=f4&er4=%40' }

In fact, it does not do any percent encoding/decoding at all in query/search -with the exception of opt-in querystring parsing (parseQueryString argument) or when encoding an object including query params to a full url-.
In this case (querystring/search whatever you call it) it is pretty obvious (decoding without parsing leads to incorrect data, ie: '?a=%26b'), and it is kind of implicitly documented in the examples, though.

But stating it clearly in the docs for pathname and pathname part in path should let api users avoid the 'implemetation' vs 'intended' behavior dilemma: trusty, future-proof('till api change) behavior.

I'm ssuming that it is intended behavior. If it happens to be an implementation detail... i'm not related to the project but if asked would be +1 on current behavior: raw original data available, that can be decoded if needed, so we don't lose upper/lowercase info for percent escapes (of significance to oauth1.0a).

Notes: http module: url property in IncomingMessages (http.Server 'request' event) is consistent with url module behavior right now. "Fix" docs too ?

PD: My humble apologies for the poor quality of my mind's English implementation.

Activity

  1. mscdex
    added
    docIssues and PRs related to Node.js documentation.
    urlIssues and PRs related to the legacy built-in url module.
    on Apr 27, 2015
  2. Fishrock123
    added
    good first issueIssues that are suitable for first-time contributors.
    on Apr 28, 2015
  3. Fishrock123
    changed the title [-]API Documentation: url module, state behavior with respect to pathname and percent encoding[/-] [+]docs: state behavior for url pathname and percent encoding[/+] on Apr 28, 2015
  4. silverwind
    added a commit that references this issue on May 25, 2015

    doc: state url decoding behavior

    a74c2c9
  5. silverwind commented on May 25, 2015

    @silverwind
    silverwind
    on May 25, 2015
    Contributor
    More actions

    Fixed by a74c2c9

  6. silverwind
    closed this as completedon May 25, 2015
  7. andrewdeandrade
    added a commit that references this issue on Jun 3, 2015

    doc: state url decoding behavior

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.good first issueIssues that are suitable for first-time contributors.urlIssues and PRs related to the legacy built-in url module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.