rfc3986

Is a URL with // in the path-section valid?

感情迁移 提交于 2019-12-28 05:36:15
问题 I have a question regarding URLs: I've read the RFC 3986 and still have a question about one URL: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character. If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//"). In addition, a URI reference (Section 4.1) may be a relative-path reference, in which case the first path segment cannot contain a colon (":") character. The ABNF

RFC3986 - which pchars need to be percent-encoded?

谁都会走 提交于 2019-12-23 07:20:08
问题 I need to generate a href to a URI. All easy with the exception when it comes to reserved characters which need percent-encoding, e.g. link to /some/path;element should appear as <a href="/some/path%3Belement"> (I know that path;element represents a single entity). Initially I was looking for a Java library that does this but I ended up writing something myself (look below for what failed with Java, as this question isn't Java-specific ). So, RFC 3986 does suggest when NOT to encode. This

Resolving relative URLs in JavaScript

白昼怎懂夜的黑 提交于 2019-12-18 17:34:20
问题 I'm building a JS library which has a requirement of looking at form[action] and a[href] values and resolving them into absolute URLs. For example, I'm on http://a/b/c/d;p?q and encounter an href value of "../g" (assume there's no <base> element). The resulting absolute would be: http://a/b/g. Is there a JS library that does this already? I'd have to believe so. For more info about what's needed, the spec: http://tools.ietf.org/html/rfc3986#section-5.4 回答1: It turns out that the .href

What does “abempty” mean in the term “path-abempty” in the context of RFC3986?

北战南征 提交于 2019-12-07 06:05:43
问题 See: https://tools.ietf.org/html/rfc3986#section-3 And: https://tools.ietf.org/html/rfc3986#section-3.3 The origin of "abempty" is mysterious to me, and a quick search didn't turn up any definitions of it. 回答1: "abempty", as it states in the comments to the right of its usage in the rfc you reference, means that its value can be either an ab solute path or empty so ( abempty ). 回答2: “Abempty”, meaning away from empty, describes the path’s relationship to its preceding authority. Where path

Is question mark in URL part of query string?

♀尐吖头ヾ 提交于 2019-12-06 00:11:04
问题 TL;TR: Is (first) question mark in URL part of query or is is just a separator followed by query? The RFC 1738, section 3.3, suggests that the "?" (question mark) is not part of the query string, but just separates it from the path: http://<host>:<port>/<path>?<searchpart> Grammar presented in the RFC 3986, Appendix A., also indicate the "?" is not part of the actual query string: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] Now, let's consider two URLs: http://server.com/api

What does “abempty” mean in the term “path-abempty” in the context of RFC3986?

我们两清 提交于 2019-12-05 10:19:11
See: https://tools.ietf.org/html/rfc3986#section-3 And: https://tools.ietf.org/html/rfc3986#section-3.3 The origin of "abempty" is mysterious to me, and a quick search didn't turn up any definitions of it. "abempty", as it states in the comments to the right of its usage in the rfc you reference, means that its value can be either an ab solute path or empty so ( abempty ). “Abempty”, meaning away from empty, describes the path’s relationship to its preceding authority. Where path-abempty is relevant, the hier-part consists of “//”, authority, and path-abempty. The authority component may be

Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

余生颓废 提交于 2019-11-30 17:39:33
I believe the definition and implementation of Java's URI.resolve method is incompatible with RFC 3986 section 5.2.2 . I understand that the Java API defines how that method works, and if it were changed now it would break existing apps, but my question is this: Can anyone confirm my understanding that this method is incompatible with RFC 3986? I'm using the example from this question: java.net.URI resolve against only query string , which I will copy here: I'm trying to build URI's using the JDK java.net.URI. I want to append to an absolute URI object, a query (in String). In example: URI

Resolving relative URLs in JavaScript

一个人想着一个人 提交于 2019-11-30 15:45:05
I'm building a JS library which has a requirement of looking at form[action] and a[href] values and resolving them into absolute URLs. For example, I'm on http://a/b/c/d;p?q and encounter an href value of "../g" (assume there's no <base> element). The resulting absolute would be: http://a/b/g . Is there a JS library that does this already? I'd have to believe so. For more info about what's needed, the spec: http://tools.ietf.org/html/rfc3986#section-5.4 Jeremy Dunck It turns out that the .href attribute of a A element (not .getAttribute('href') , but .href ) returns the resolved (absolute) URL

Can HTTP URIs have non-ASCII characters?

半城伤御伤魂 提交于 2019-11-30 07:22:06
问题 I tried to find this in the relevant RFC, IETF RFC 3986, but couldn't figure it. Do URIs for HTTP allow Unicode, or non-ASCII of any kind? Can you please cite the section and the RFC that supports your answer. NB: For those who might think this is not programming related - it is. It's related to an ISAPI filter I'm building. Addendum I've read section 2.5 of RFC 3986. But RFC 2616, which I believe is the current HTTP protocol, predates 3986, and for that reason I'd suppose it cannot be

Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

感情迁移 提交于 2019-11-30 01:33:01
问题 I believe the definition and implementation of Java's URI.resolve method is incompatible with RFC 3986 section 5.2.2. I understand that the Java API defines how that method works, and if it were changed now it would break existing apps, but my question is this: Can anyone confirm my understanding that this method is incompatible with RFC 3986? I'm using the example from this question: java.net.URI resolve against only query string, which I will copy here: I'm trying to build URI's using the