Skip to content

define how to handle / in component values when represented as a string #178

Description

@achingbrain

When a component value has a / in it, it becomes hard to round-trip a multiaddr from bytes to a string and back again, since it's unclear where the value ends and the next protocol component starts.

A growing list of where this is relevant:

  • /http-path has solved this problem by url-encoding the value (see Define /http-path #164).
  • /unix needs a similar solution: Define /unix #174
  • Potentially adding libp2p protocols to multiaddrs has come up in chore: add tag code multicodec#380 (yes, wrong repo) which are full of / characters.
  • In the scope of define a string representation for unparsable multiaddresses #155 - where we might parse a multiaddr from a string that contains protocol components we don't understand, for example /ip4/123.123.123.123/my-new-protocol/herp/derp. The unknown protocol would be easier to ignore if it was encountered as /ip4/123.123.123.123/my-new-protocol/herp%2Fderp (though obviously it can't be round-tripped as we don't know what the protocol code for my-new-protocol is).

Perhaps it's time to specify how to handle this character properly?

Represent it in the string version of a multiaddr as %2F?

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions