A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

Difference between revisions of "URL"

From WHATWG Wiki
Jump to: navigation, search
(IDNA: update notes)
(Schemes)
Line 47: Line 47:
 
==Schemes==
 
==Schemes==
  
Currently the parser does not separate out query, this could be problematic for about and maybe mailto.
+
Post-processing of parsed URLs:
  
* data
+
; ftp
* javascript
+
; gopher
* mailto
+
; http
* about (uselessly defined in RFC 6694)
+
; https
 +
; ws
 +
; wss : These all can be used by the corresponding protocol directly.
 +
; file : Needs platform-specific interpretation and mapping to a resource on a the local file system.
 +
; data : Needs its resource and MIME type information retrieved from its scheme data/query.
 +
; javascript : Needs its resource retrieved from its scheme data/query/fragment.
 +
; mailto : Needs information extracted from scheme data/query. Fragment is not used right?
 +
; about : The resource is effectively the result of passing scheme data to a hash table (not sure if case-sensitive or not; definitely no percent decoding). Query and fragment can be used by the resource.
  
 
==IDNA==
 
==IDNA==

Revision as of 17:50, 24 November 2012

This documents research and notes around URLs for the URL standard.

Implementations

Tests

Variants of the following code (runs in Live DOM Viewer) are useful to test which code points are URL escaped in browsers:

<!DOCTYPE html>
<script>
var a = document.createElement("a")

i = 0
cp = 0x100

while ( i < cp ) {
  a.href = "http://x" + String.fromCharCode(i) + "@x/"
  if(a.href.length != "http://x)@x/".length) {
    w(a.href)
  }
  i++
}
</script>

Parsing

JavaScript libraries

For improving the API we might want to take inspiration from:

Schemes

Post-processing of parsed URLs:

ftp
gopher
http
https
ws
wss 
These all can be used by the corresponding protocol directly.
file 
Needs platform-specific interpretation and mapping to a resource on a the local file system.
data 
Needs its resource and MIME type information retrieved from its scheme data/query.
javascript 
Needs its resource retrieved from its scheme data/query/fragment.
mailto 
Needs information extracted from scheme data/query. Fragment is not used right?
about 
The resource is effectively the result of passing scheme data to a hash table (not sure if case-sensitive or not; definitely no percent decoding). Query and fragment can be used by the resource.

IDNA

Definitions:

  • IDNA2003+: IDNA2003 with Unicode updated to the latest version. (So not NFKC from Unicode 3.2., although Python might do that... ) Restrictions on display might be in place.
  • IDNA2008+: IDNA2008 with RFC 5895 section 2 mapping and IDNA2003 domain label separators. Display is restricted to IDNA2008, lookup is unrestricted (everything gets Punycoded).

Implementations:

  • IDNA2003+: Safari, Chrome, Firefox, Internet Explorer
  • IDNA2008+: Opera

Tests:

Required algorithms:

  • ToLabels(domain string) -> ASCII-label list (empty label at the end signifies trailing dot) or failure.
  • ToASCII(Unicode-label) -> ASCII-label.
  • ToUnicode(ASCII-label) -> Unicode label.

(For convenience maybe ToASCII and ToUnicode should accept lists too.)

Notes: