| 1 | URL Pathnames ABCL |
|---|
| 2 | ================== |
|---|
| 3 | |
|---|
| 4 | Mark Evenson |
|---|
| 5 | Created: 25 MAR 2010 |
|---|
| 6 | Modified: 11 APR 2010 |
|---|
| 7 | |
|---|
| 8 | Notes towards an implementation of URL references to be contained in |
|---|
| 9 | Common Lisp `PATHNAME` objects within ABCL. |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | References |
|---|
| 13 | ---------- |
|---|
| 14 | |
|---|
| 15 | RFC3986 Uniform Resource Identifier (URI): Generic Syntax |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | URL vs URI |
|---|
| 19 | ---------- |
|---|
| 20 | |
|---|
| 21 | We use the term URL to describe the URL Pathnames, even though RFC3986 |
|---|
| 22 | notes that its use should be obsolete because in the context of Common |
|---|
| 23 | Lisp Pathnames all need a lookup mechanism to be resolved or they |
|---|
| 24 | wouldn't be of much use. |
|---|
| 25 | |
|---|
| 26 | Goals |
|---|
| 27 | ----- |
|---|
| 28 | |
|---|
| 29 | 1. Use Common Lisp pathnames to refer to representations referenced |
|---|
| 30 | by a URL. |
|---|
| 31 | |
|---|
| 32 | 2. The URL schemes supported shall include at least "http", and those |
|---|
| 33 | enabled by the URLStreamHandler extension mechanism. |
|---|
| 34 | |
|---|
| 35 | 3. Use URL schemes that are understood by the java.net.URL object. |
|---|
| 36 | |
|---|
| 37 | A file specified by URL |
|---|
| 38 | |
|---|
| 39 | #p"http://example.org/org/armedbear/systems/pgp.asd" |
|---|
| 40 | |
|---|
| 41 | 4. MERGE-PATHNAMES |
|---|
| 42 | |
|---|
| 43 | (merge-pathnames "url.asd" |
|---|
| 44 | "http://example/org/armedbear/systems/pgp.asd") |
|---|
| 45 | ==> "http://example/org/armedbear/systems/url.asd" |
|---|
| 46 | |
|---|
| 47 | 5. PROBE-FILE returning the state of URL accesibility. |
|---|
| 48 | |
|---|
| 49 | 6. TRUENAME "aliased" to PROBE-FILE signalling an error if the URL is |
|---|
| 50 | not accessible (see "Non-goal 1"). |
|---|
| 51 | |
|---|
| 52 | 7. DIRECTORY for non-wildcards |
|---|
| 53 | |
|---|
| 54 | 8. URL pathname work as a valid argument for OPEN with :DIRECTION :INPUT. |
|---|
| 55 | |
|---|
| 56 | 9. Enable the loading of ASDF2 systems referenced by a URL pathname. |
|---|
| 57 | |
|---|
| 58 | 10. The reserved URL characters (`~`, `/`, `?`, etc.) shall be |
|---|
| 59 | encoded in the proper manner on construction of the Pathname. |
|---|
| 60 | |
|---|
| 61 | 11. The "file" scheme will continue to be represented by an |
|---|
| 62 | "ordinary" Pathname. |
|---|
| 63 | |
|---|
| 64 | 12. The "jar" scheme will continue to be represented by a jar |
|---|
| 65 | Pathname. |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | Non-goals |
|---|
| 69 | --------- |
|---|
| 70 | |
|---|
| 71 | 1. We will not implement canonicalization of URL schemas (such as following |
|---|
| 72 | "http" redirects). |
|---|
| 73 | |
|---|
| 74 | 2. DIRECTORY working for URL pathnames containing wildcards. |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | Implementation |
|---|
| 78 | -------------- |
|---|
| 79 | |
|---|
| 80 | A PATHNAME refering to a resource referenced by a URL is known as a |
|---|
| 81 | URL PATHNAME. |
|---|
| 82 | |
|---|
| 83 | A URL PATHNAME always has a HOST component which is a proper list. |
|---|
| 84 | This list will be an property list (plist). The property list |
|---|
| 85 | values must be character strings. |
|---|
| 86 | |
|---|
| 87 | :SCHEME |
|---|
| 88 | Scheme of URI ("http", "ftp", "bundle", etc.) |
|---|
| 89 | :AUTHORITY |
|---|
| 90 | Valid authority according to the URI scheme. For "http" this |
|---|
| 91 | could be "example.org:8080". |
|---|
| 92 | :QUERY |
|---|
| 93 | The query of the URI |
|---|
| 94 | :FRAGMENT |
|---|
| 95 | The fragment portion of the URI |
|---|
| 96 | |
|---|
| 97 | The DIRECTORY, NAME and TYPE fields of the PATHNAME are used to form |
|---|
| 98 | the URI `path` according to the conventions of the UNIX filesystem |
|---|
| 99 | (i.e. '/' is the directory separator). In a sense the HOST contains |
|---|
| 100 | the base URL, to which the `path` is a relative URL (although this |
|---|
| 101 | abstraction is violated somwhat by the storing of the QUERY and |
|---|
| 102 | FRAGMENT portions of the URI in the HOST component). |
|---|
| 103 | |
|---|
| 104 | For the purposes of PATHNAME-MATCH-P, two URL pathnames may be said to |
|---|
| 105 | match if their HOST compoments are EQUAL, and all other components are |
|---|
| 106 | considered to match according to the existing rules for Pathnames. |
|---|
| 107 | |
|---|
| 108 | A URL pathname must have a DEVICE whose value is NIL. |
|---|
| 109 | |
|---|
| 110 | Upon creation, the presence of ".." and "." components in the |
|---|
| 111 | DIRECTORY are removed. The DIRECTORY component, if present, is always |
|---|
| 112 | absolute. |
|---|
| 113 | |
|---|
| 114 | The namestring of a URL pathname shall be formed by the usual |
|---|
| 115 | conventions of a URL. |
|---|
| 116 | |
|---|
| 117 | A URL Pathname has type URL-PATHNAME, derived from PATHNAME. |
|---|
| 118 | |
|---|
| 119 | Status |
|---|
| 120 | ------ |
|---|
| 121 | |
|---|
| 122 | This design is a proposal. |
|---|