source: project/wiki/uri-generic @ 11868

Last change on this file since 11868 was 11868, checked in by Ivan Raikov, 13 years ago

Added an entry for version 1.6. Moved absolute-uri to constructor
list.

File size: 4.4 KB
Line 
1[[tags: eggs]]
2[[toc:]]
3
4== uri-generic
5
6=== Description
7
8The {{uri-generic}} library contains procedures for parsing and
9manipulation of Uniform Resource Identifiers
10([[http://tools.ietf.org/html/rfc3986|RFC 3986]]). It is intended to
11conform more closely to the RFC, and uses combinator parsing and
12character classes rather than regular expressions.
13
14=== Library Procedures
15
16==== Constructors
17
18<procedure>(uri-reference STRING) => URI</procedure>
19
20A URI reference is either a URI or a relative reference (RFC 3986,
21Section 4.1).  If the given string's prefix does not match the syntax
22of a scheme followed by a colon separator, then the given string is
23parsed as a relative reference.
24
25<procedure>(absolute-uri STRING) => URI</procedure>
26
27Parses the given string as an absolute URI, in which no fragments are
28allowed (RFC 3986, Section 4.2)
29
30
31==== Predicates and Accessors
32
33<procedure>(uri? URI) => BOOL</procedure>
34<procedure>(uri-authority URI) => URI-AUTH</procedure>
35<procedure>(uri-scheme URI) => SYMBOL</procedure>
36<procedure>(uri-path URI) => LIST</procedure>
37<procedure>(uri-query URI) => LIST</procedure>
38<procedure>(uri-fragment) URI => STRING</procedure>
39<procedure>(uri-host URI) => STRING</procedure>
40<procedure>(uri-port URI) => INTEGER</procedure>
41<procedure>(uri-username URI) => STRING</procedure>
42<procedure>(uri-password URI) => STRING</procedure>
43
44If a component is not defined in the given URI, then the corresponding
45accessor returns {{#f}}.
46
47==== String and List Representations
48
49<procedure>(uri->string URI USERINFO) => STRING</procedure>
50
51Reconstructs the give URI into a string; uses a supplied function
52{{LAMBDA USERNAME PASSWORD -> STRING}} to map the userinfo part of the
53URI
54
55<procedure>(uri->list URI USERINFO) => LIST</procedure>
56
57Returns a list of the form {{(SCHEME SPECIFIC FRAGMENT)}};
58{{SPECIFIC}} is of the form {{(AUTHORITY PATH QUERY)}}.
59
60==== Reference Resolution
61
62<procedure>(uri-relative-to URI URI) => URI</procedure>
63
64Constructs an absolute URI given a relative URI and a base URI (RFC 3986, Section 5.2.2)
65
66<procedure>(uri-relative-from URI URI) => URI</procedure>
67
68Constructs a new, possibly relative, URI which represents the location
69of the first URI with respect to the second URI.
70
71==== Normalization 
72
73<procedure>(uri-normalize-case URI) => URI</procedure>
74
75URI case normalization (RFC 3986 section 6.2.2.1)
76
77<procedure>(uri-normalize-path-segments URI) => URI</procedure>
78
79URI path segment normalization (RFC 3986 section 6.2.2.3)
80
81=== Requires
82
83; [[matchable]]
84; [[defstruct]]
85
86=== Version History
87
88* 1.6 Added error message about missing scheme in absolute-uri.
89* trunk Small bugfix in absolute-uri. [Peter Bex]
90* 1.5 Bug fixes in uri->string and absolute-uri. [reported by Peter Bex]
91* 1.3 Ported to Hygienic Chicken and the [[test]] egg [Peter Bex]
92* 1.2 Now using defstruct instead of define-record [suggested by Peter Bex]
93* 1.1 Added utf8 compatibility
94* 1.0 Initial Release
95
96=== License
97
98Based on the [[http://www.ninebynine.org/Software/ReadMe-URI-Haskell.txt|Haskell URI library]] by  Graham Klyne <gk@ninebynine.org>.
99
100Copyright 2008 Ivan Raikov.
101
102Redistribution and use in source and binary forms, with or without
103modification, are permitted provided that the following conditions are
104met:
105
106- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
107
108- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
109
110- Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
111
112THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
Note: See TracBrowser for help on using the repository browser.