Reputation: 610
Our system directs users to a relative path in this format:
/some_path/?query=string
The server then responds to said path. Is that URL in violation of the RFC that anyone can tell? (I believe RFC 3986 applies.)
Specifically, is the previous path OK, even though it doesn't specify a filename, as in:
/some_path/file?query=string
Upvotes: 1
Views: 1414
Reputation: 9324
What you're showing is probably OK. Here's more detail:
Your question is a tiny bit vague - You're referring to a URL, but what you're showing us isn't technically a URL or URI. A URL or URI has to be of this syntax:
scheme://authority/path?query#fragment
eg: http://host.domain.ext/path/to?query=1#anchor1
What you appear to be returning is a relative-ref or perhaps (depending on where you're returning it, e.g. in an XML body) an href
So what you appear to be returning (according to RFC 3986) is a relativeURI. the RFC shows this as:
relativeURI | relative-part [ "?" query ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
Which is fine, in some cases.
According to the HTTP RFC 2616 - some header values may be returned as a relativeURI such as Content-Location and Referer, while others (Such as Location) are defined as REQUIRING an absoluteURI. Having said that, most browsers and other clients will accept a relativeURI there.
Yes, a path with no 'filename' in your case is probably fine, and is a valid relativeURI (a relative part with an added query string). You may have any valid characters as a path, including a trailing slash if desired (although this is used to represent hierarchy, so be careful).
Upvotes: 2