1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
9 * nsIURLParser specifies the interface to an URL parser that attempts to
10 * follow the definitions of RFC 2396.
12 [scriptable
, uuid(78c5d19f
-f5d2
-4732-8d3d
-d5a7d7133bc0
)]
13 interface nsIURLParser
: nsISupports
16 * The string to parse in the following methods may be given as a null
17 * terminated string, in which case the length argument should be -1.
19 * Out parameters of the following methods are all optional (ie. the caller
20 * may pass-in a NULL value if the corresponding results are not needed).
21 * Signed out parameters may hold a value of -1 if the corresponding result
22 * is not part of the string being parsed.
24 * The parsing routines attempt to be as forgiving as possible.
28 * ParseSpec breaks the URL string up into its 3 major components: a scheme,
29 * an authority section (hostname, etc.), and a path.
31 * spec = <scheme>://<authority><path>
33 void parseURL
(in string spec
, in long specLen
,
34 out unsigned long schemePos
, out long schemeLen
,
35 out unsigned long authorityPos
, out long authorityLen
,
36 out unsigned long pathPos
, out long pathLen
);
39 * ParseAuthority breaks the authority string up into its 4 components:
40 * username, password, hostname, and hostport.
42 * auth = <username>:<password>@<hostname>:<port>
44 void parseAuthority
(in string authority
, in long authorityLen
,
45 out unsigned long usernamePos
, out long usernameLen
,
46 out unsigned long passwordPos
, out long passwordLen
,
47 out unsigned long hostnamePos
, out long hostnameLen
,
51 * userinfo = <username>:<password>
53 void parseUserInfo
(in string userinfo
, in long userinfoLen
,
54 out unsigned long usernamePos
, out long usernameLen
,
55 out unsigned long passwordPos
, out long passwordLen
);
58 * serverinfo = <hostname>:<port>
60 void parseServerInfo
(in string serverinfo
, in long serverinfoLen
,
61 out unsigned long hostnamePos
, out long hostnameLen
,
65 * ParsePath breaks the path string up into its 3 major components: a file path,
66 * a query string, and a reference string.
68 * path = <filepath>?<query>#<ref>
70 void parsePath
(in string path
, in long pathLen
,
71 out unsigned long filepathPos
, out long filepathLen
,
72 out unsigned long queryPos
, out long queryLen
,
73 out unsigned long refPos
, out long refLen
);
76 * ParseFilePath breaks the file path string up into: the directory portion,
77 * file base name, and file extension.
79 * filepath = <directory><basename>.<extension>
81 void parseFilePath
(in string filepath
, in long filepathLen
,
82 out unsigned long directoryPos
, out long directoryLen
,
83 out unsigned long basenamePos
, out long basenameLen
,
84 out unsigned long extensionPos
, out long extensionLen
);
87 * filename = <basename>.<extension>
89 void parseFileName
(in string filename
, in long filenameLen
,
90 out unsigned long basenamePos
, out long basenameLen
,
91 out unsigned long extensionPos
, out long extensionLen
);