source: project/wiki/uri-generic @ 11828

Last change on this file since 11828 was 11828, checked in by sjamaan, 13 years ago

Add note about bugfix in absolute-uri

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==== Predicates and Accessors
26
27<procedure>(uri? URI) => BOOL</procedure>
28<procedure>(uri-authority URI) => URI-AUTH</procedure>
29<procedure>(uri-scheme URI) => SYMBOL</procedure>
30<procedure>(uri-path URI) => LIST</procedure>
31<procedure>(uri-query URI) => LIST</procedure>
32<procedure>(uri-fragment) URI => STRING</procedure>
33<procedure>(uri-host URI) => STRING</procedure>
34<procedure>(uri-port URI) => INTEGER</procedure>
35<procedure>(uri-username URI) => STRING</procedure>
36<procedure>(uri-password URI) => STRING</procedure>
37
38If a component is not defined in the given URI, then the corresponding
39accessor returns {{#f}}.
40
41==== String and List Representations
42
43<procedure>(uri->string URI USERINFO) => STRING</procedure>
44
45Reconstructs the give URI into a string; uses a supplied function {{LAMBDA USERNAME PASSWORD -> STRING}} to map the userinfo part of the URI
46
47<procedure>(uri->list URI USERINFO) => LIST</procedure>
48
49Returns a list of the form {{(SCHEME SPECIFIC FRAGMENT)}}; {{SPECIFIC}} is of the form {{(AUTHORITY PATH QUERY)}}.
50
51==== Reference Resolution
52
53<procedure>(absolute-uri STRING) => URI</procedure>
54
55Parses the given string as an absolute URI, in which no fragments are allowed (RFC 3986, Section 4.2)
56
57<procedure>(uri-relative-to URI URI) => URI</procedure>
58
59Constructs an absolute URI given a relative URI and a base URI (RFC 3986, Section 5.2.2)
60
61<procedure>(uri-relative-from URI URI) => URI</procedure>
62
63Constructs a new, possibly relative, URI which represents the location of the first URI with respect to the second URI.
64
65==== Normalization 
66
67<procedure>(uri-normalize-case URI) => URI</procedure>
68
69URI case normalization (RFC 3986 section 6.2.2.1)
70
71<procedure>(uri-normalize-path-segments URI) => URI</procedure>
72
73URI path segment normalization (RFC 3986 section 6.2.2.3)
74
75=== Requires
76
77; [[matchable]]
78; [[defstruct]]
79
80=== Version History
81
82* trunk Small bugfix in absolute-uri. [Peter Bex]
83* 1.5 Bug fixes in uri->string and absolute-uri. [reported by Peter Bex]
84* 1.3 Ported to Hygienic Chicken and the [[test]] egg [Peter Bex]
85* 1.2 Now using defstruct instead of define-record [suggested by Peter Bex]
86* 1.1 Added utf8 compatibility
87* 1.0 Initial Release
88
89=== License
90
91Based on the [[http://www.ninebynine.org/Software/ReadMe-URI-Haskell.txt|Haskell URI library]] by  Graham Klyne <gk@ninebynine.org>.
92
93Copyright 2008 Ivan Raikov.
94
95Redistribution and use in source and binary forms, with or without
96modification, are permitted provided that the following conditions are
97met:
98
99- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
100
101- 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.
102
103- 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.
104
105THIS 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.
106
Note: See TracBrowser for help on using the repository browser.