]> sjero.net Git - wget/blob - src/url.h
Merging with previous Makefile.in updates.
[wget] / src / url.h
1 /* Declarations for url.c.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3    2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
5 This file is part of GNU Wget.
6
7 GNU Wget is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Wget is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Wget.  If not, see <http://www.gnu.org/licenses/>.
19
20 In addition, as a special exception, the Free Software Foundation
21 gives permission to link the code of its release of Wget with the
22 OpenSSL project's "OpenSSL" library (or with modified versions of it
23 that use the same license as the "OpenSSL" library), and distribute
24 the linked executables.  You must obey the GNU General Public License
25 in all respects for all of the code used other than "OpenSSL".  If you
26 modify this file, you may extend this exception to your version of the
27 file, but you are not obligated to do so.  If you do not wish to do
28 so, delete this exception statement from your version.  */
29
30 #ifndef URL_H
31 #define URL_H
32
33 /* Default port definitions */
34 #define DEFAULT_HTTP_PORT 80
35 #define DEFAULT_FTP_PORT 21
36 #define DEFAULT_HTTPS_PORT 443
37
38 /* Specifies how, or whether, user auth information should be included
39  * in URLs regenerated from URL parse structures. */
40 enum url_auth_mode {
41   URL_AUTH_SHOW,
42   URL_AUTH_HIDE_PASSWD,
43   URL_AUTH_HIDE
44 };
45
46 /* Note: the ordering here is related to the order of elements in
47    `supported_schemes' in url.c.  */
48
49 enum url_scheme {
50   SCHEME_HTTP,
51 #ifdef HAVE_SSL
52   SCHEME_HTTPS,
53 #endif
54   SCHEME_FTP,
55   SCHEME_INVALID
56 };
57
58 /* Structure containing info on a URL.  */
59 struct url
60 {
61   char *url;                    /* Original URL */
62   enum url_scheme scheme;       /* URL scheme */
63
64   char *host;                   /* Extracted hostname */
65   int port;                     /* Port number */
66
67   /* URL components (URL-quoted). */
68   char *path;
69   char *params;
70   char *query;
71   char *fragment;
72
73   /* Extracted path info (unquoted). */
74   char *dir;
75   char *file;
76
77   /* Username and password (unquoted). */
78   char *user;
79   char *passwd;
80 };
81
82 /* Function declarations */
83
84 char *url_escape (const char *);
85
86 struct url *url_parse (const char *, int *);
87 const char *url_error (int);
88 char *url_full_path (const struct url *);
89 void url_set_dir (struct url *, const char *);
90 void url_set_file (struct url *, const char *);
91 void url_free (struct url *);
92
93 enum url_scheme url_scheme (const char *);
94 bool url_has_scheme (const char *);
95 int scheme_default_port (enum url_scheme);
96 void scheme_disable (enum url_scheme);
97
98 char *url_string (const struct url *, enum url_auth_mode);
99 char *url_file_name (const struct url *);
100
101 char *uri_merge (const char *, const char *);
102
103 int mkalldirs (const char *);
104
105 char *rewrite_shorthand_url (const char *);
106 bool schemes_are_similar_p (enum url_scheme a, enum url_scheme b);
107
108 bool are_urls_equal (const char *u1, const char *u2);
109
110 #endif /* URL_H */