Is it intended? Do I need to redirect from www to non-www to get it working? Thanks
OAuth 2.0 specification says:
The redirection URI MUST be an absolute URI which
MAY include a query component which MUST be retained by
the authorization server when adding additional query parameters, and
MUST NOT include a fragment component.
The grammer for absolute URI as defined by RFC3986 is :
absolute-URI = scheme ":" hier-part [ "?" query ]
It means each absolute-URI begins with a scheme name that refers to a specification for assigning identifiers within that scheme.
here is your answer:
Yes it is intended.
Redirection uri should be an Absolute-URI. it must starts with any scheme like http, https, ftp etc and followed by a colon(:).
eg: http://www.google.com is an absolute URI.
hope it would be helpful.
Related
Is there a word for the URL schema/protocol taken together with the colon and two slashes, for example http://, mailto://, ftp://?
I thought to call it a prefix, yet Microsoft already has UrlPrefix. Probably copyrighted.
RFC 1738 – Uniform Resource Locators (URL) – is surprisingly silent on that matter.
However, in the URI RFC3986, we find:
e.g., most registered names beginning with "www"
are likely to have a URI prefix of "http://"
Via: RFC3986 Section 4.5 -- Uniform Resource Identifier (URI): Generic Syntax
Note that URIs are a superset of URLs and that for a URI, only a schema and path (which may be empty) is required.
See: Syntax Components
More on the difference between URL and URI:
https://danielmiessler.com/study/difference-between-uri-url/
What is the difference between a URI, a URL and a URN?
For all A and B such that A://B, A is defined as the schema of B
On some input we allow the following paths:
C:\Folder
\\server\Folder
http://example.com/...
Can I mark them all as "URI"s?
C:/Folder and /server/Folder/ are file paths.
http://example.com/ is a URL, which is a URI sub-type, so you could mark it as a URI but not the other way around (like how squares are rectangles but not vice versa).
Of course, here you have posted a clear, simple example. When discussing the distinction between URI and URL, not only is the answer not clear cut, it is also disputed. I recommend taking a look at this thread and the answers posted in it for clarification. Generally though, it is mostly agreed that the main difference is that URLs provide an access method (such as http://).
So if we were to convert your first file path into a URL it would become the following (note the addition of the access method):
file:///c:/Folder/test.txt
If you modify all your file paths to include an access method like in my example, then it will be okay for you to mark them as URIs.
Strictly speaking no, unless you make sure it's an absolute path and add add "file://" to the beginning.
As per RFC 3986 Section 3:
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
The scheme and the ":" are not in square brackets [], which means they are not optional.
However, the HTML standard calls these "path-relative-scheme-less-URL strings" and they're valid in the href attribute of an HTML element so maybe it's fine to call relative Unix paths "URLs" (not absolute Unix paths or Windows paths though).
Why does http:// contain two slashes—is that just a standard for a URL, or does it have any logical meaning? And why does file:/// contain three slashes, as in file:///C:/a.html?
The authority component of a URI has to be preceded by //:
The authority component is preceded by a double slash ("//") […]
This is also why not all URIs contain the double slash: because not all URIs have an authority component (e.g., URIs using the mailto scheme, the xmpp scheme, etc.).
If you wonder why the double slash instead of something else (or nothing) was chosen for (HTTP) URIs, see Tim Berners-Lee’s FAQ Why the //, #, etc? → What is the history of the //?
tl;dr: He copied the filename syntax which Apollo used.
By the way, he regrets that choice:
I have to say that now I regret that the syntax is so clumsy. I would like http://www.example.com/foo/bar/baz to be just written http:com/example/foo/bar/baz where the client would figure out that www.example.com existed and was the server to contact. But it is too late now.
As mentioned in this superuser post:
The complete syntax is file://host/path.
If the host is localhost, it can be omitted, resulting in
file:///path.
In other words, referring to files in your computer is just like referring to files in localhost.
I want to validate a URL in Rails using URI.Parse, by saying that the URL is valid as long as URI.parse does not raise URI::InvalidURIError. Is that a good idea? What URLs would pass this validation test?
Yes, it's a good idea if you plan to use those URLs in your app.
URI will prove the string is parseable into these parts: scheme, userinfo, host, port,
registry, path, opaque, query, fragment.
URI handles these schemes:
FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo
or URI::Generic
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI/Parser.html#method-i-parse
If you have other schemes, you can handle them yourself after the parse.
URI.parse works by calling URI.split, which uses two regular expressions:
URI::ABS_URI for absolute URIs
URI::REL_URI for relative URIs
You can look at these to see how they match. You can alter them too if you like.
I was recently asked to add some Woopra JavaScript to a website and noticed that the URL started with a double slash (i.e. omitted the scheme). I've never seen this before, so I went trying to find out more about it, but the only thing I could really find was an item on the Woopra FAQ:
The Woopra JavaScript in the Setup does not include http in the URL call for the script. This is correct. The JavaScript has been optimized to run very fast and efficiently on your site.
However, some validation and site testing/debugging services and tools do not recognize the code as correct. It is correct and valid. If the warnings annoy you, just add the http to the script’s URL. It will not impact the script.
(For clarification, the URL is "//static.woopra.com/js/woopra.v2.js"—the colon is omitted in addition to the "http".)
Is there any more information about this practice? If this is indeed valid, there must be a spec that talks about it, and I'd very much like to see it.
Thanks in advance for satisfying my curiousity!
This is a valid URL. It's called a "network-path reference" as defined in RFC 3986. When you don't specify a scheme/protocol, it will fall back to the current scheme. So if you are viewing a page via https:// all network path references will also use https.
For an example, here's a link to the RFC 3986 document again but with a network path reference. If you were viewing this page over https (although it looks like you can't use https with StackOverflow) the link will reflect your current URI scheme, unlike the first link.
See RFC 3986, section 3:
The generic URI syntax consists of a
hierarchical sequence of components
referred to as the scheme, authority,
path, query, and fragment.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment
]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
The scheme and path components are
required, though the path may be
empty (no characters).