Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server should partially encode Slug header values #339

Open
langsamu opened this issue Oct 29, 2021 · 1 comment
Open

Server should partially encode Slug header values #339

langsamu opened this issue Oct 29, 2021 · 1 comment

Comments

@langsamu
Copy link

Servers MAY allow clients to suggest the URI of a resource created through POST, using the HTTP Slug header as defined in [RFC5023].

5.1 Resource Type Heuristics

The value supplied by a caller in the Slug header ends up an being an IRI path segment.
Because of this, implementations must deal with slug characters that would be invalid in a segment.
At least one implementation currently strips invalid characters.

I propose mandating that implementations percent encode offending characters if they honour the slug:

POST /container/
Slug: a/b

HTTP 201
Location: /container/a%2Fb

We should suggest that servers do not encode any other character but the ones illegal in path segments:

POST /container/
Slug: fancy-slug!

HTTP 201
Location: /container/fancy-slug!

The offending class of characters that should be encoded is anything outside of pchar (RFC 3986).

@kjetilk
Copy link
Member

kjetilk commented Oct 29, 2021

Yes, the topic of more sophisticated use of Slug has been discussed at some length, mainly in #128 (comment) and onwards. We decided not to tackle it yet.

However, the slugtext is just a hint to the server of what the server might want to do, and some of these details may also be left as implementation detail. Personally, I could see us assign meaning to slashes to create containers :-) Others disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants