1 /* Declarations for url.c.
2 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
4 This file is part of GNU Wget.
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Wget; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 /* Default port definitions */
24 #define DEFAULT_HTTP_PORT 80
25 #define DEFAULT_FTP_PORT 21
26 #define DEFAULT_HTTPS_PORT 443
28 /* Note: the ordering here is related to the order of elements in
29 `supported_schemes' in url.c. */
40 /* Structure containing info on a URL. */
43 char *url; /* Original URL */
44 enum url_scheme scheme; /* URL scheme */
46 char *host; /* Extracted hostname */
47 int port; /* Port number */
49 /* URL components (URL-quoted). */
55 /* Extracted path info (unquoted). */
59 /* Username and password (unquoted). */
64 enum convert_options {
65 CO_NOCONVERT = 0, /* don't convert this URL */
66 CO_CONVERT_TO_RELATIVE, /* convert to relative, e.g. to
67 "../../otherdir/foo.gif" */
68 CO_CONVERT_TO_COMPLETE /* convert to absolute, e.g. to
69 "http://orighost/somedir/bar.jpg". */
72 /* A structure that defines the whereabouts of a URL, i.e. its
73 position in an HTML document, etc. */
75 typedef struct _urlpos
77 char *url; /* linked URL, after it has been
78 merged with the base */
79 char *local_name; /* Local file to which it was saved */
81 /* Information about the original link: */
82 int link_relative_p; /* was the link relative? */
83 int link_complete_p; /* was the link complete (with the
86 /* Conversion requirements: */
87 enum convert_options convert; /* is conversion required? */
89 /* URL's position in the buffer. */
92 struct _urlpos *next; /* Next struct in list */
95 /* downloaded_file() takes a parameter of this type and returns this type. */
98 /* Return enumerators: */
99 FILE_NOT_ALREADY_DOWNLOADED = 0,
101 /* Return / parameter enumerators: */
102 FILE_DOWNLOADED_NORMALLY,
103 FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED,
105 /* Parameter enumerators: */
109 /* Function declarations */
111 char *encode_string PARAMS ((const char *));
113 struct url *url_parse PARAMS ((const char *, int *));
114 const char *url_error PARAMS ((int));
115 char *url_full_path PARAMS ((const struct url *));
116 void url_set_dir PARAMS ((struct url *, const char *));
117 void url_set_file PARAMS ((struct url *, const char *));
118 void url_free PARAMS ((struct url *));
120 enum url_scheme url_scheme PARAMS ((const char *));
121 int url_skip_scheme PARAMS ((const char *));
122 int url_has_scheme PARAMS ((const char *));
123 int scheme_default_port PARAMS ((enum url_scheme));
125 int url_skip_uname PARAMS ((const char *));
127 char *url_string PARAMS ((const struct url *, int));
129 urlpos *get_urls_file PARAMS ((const char *));
130 urlpos *get_urls_html PARAMS ((const char *, const char *, int, int *));
131 void free_urlpos PARAMS ((urlpos *));
133 char *uri_merge PARAMS ((const char *, const char *));
135 void rotate_backups PARAMS ((const char *));
136 int mkalldirs PARAMS ((const char *));
137 char *url_filename PARAMS ((const struct url *));
139 char *getproxy PARAMS ((uerr_t));
140 int no_proxy_match PARAMS ((const char *, const char **));
142 void convert_links PARAMS ((const char *, urlpos *));
143 urlpos *add_url PARAMS ((urlpos *, const char *, const char *));
145 downloaded_file_t downloaded_file PARAMS ((downloaded_file_t, const char *));
147 char *rewrite_shorthand_url PARAMS ((const char *));