Lines Matching defs:URL

60 	{ URL_MALFORMED,	FETCH_URL,	"Malformed URL" },
61 { URL_BAD_SCHEME, FETCH_URL, "Invalid URL scheme" },
70 * Select the appropriate protocol for the URL scheme, and return a
71 * read-only stream connected to the document referenced by the URL.
75 fetchXGet(struct url *URL, struct url_stat *us, const char *flags)
82 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
83 return (fetchXGetFile(URL, us, flags));
84 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
85 return (fetchXGetFTP(URL, us, flags));
86 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
87 return (fetchXGetHTTP(URL, us, flags));
88 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
89 return (fetchXGetHTTP(URL, us, flags));
95 * Select the appropriate protocol for the URL scheme, and return a
96 * read-only stream connected to the document referenced by the URL.
99 fetchGet(struct url *URL, const char *flags)
101 return (fetchXGet(URL, NULL, flags));
105 * Select the appropriate protocol for the URL scheme, and return a
106 * write-only stream connected to the document referenced by the URL.
109 fetchPut(struct url *URL, const char *flags)
112 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
113 return (fetchPutFile(URL, flags));
114 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
115 return (fetchPutFTP(URL, flags));
116 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
117 return (fetchPutHTTP(URL, flags));
118 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
119 return (fetchPutHTTP(URL, flags));
125 * Select the appropriate protocol for the URL scheme, and return the
126 * size of the document referenced by the URL if it exists.
129 fetchStat(struct url *URL, struct url_stat *us, const char *flags)
136 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
137 return (fetchStatFile(URL, us, flags));
138 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
139 return (fetchStatFTP(URL, us, flags));
140 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
141 return (fetchStatHTTP(URL, us, flags));
142 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
143 return (fetchStatHTTP(URL, us, flags));
149 * Select the appropriate protocol for the URL scheme, and return a
150 * list of files in the directory pointed to by the URL.
153 fetchList(struct url *URL, const char *flags)
156 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
157 return (fetchListFile(URL, flags));
158 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
159 return (fetchListFTP(URL, flags));
160 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
161 return (fetchListHTTP(URL, flags));
162 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
163 return (fetchListHTTP(URL, flags));
169 * Attempt to parse the given URL; if successful, call fetchXGet().
172 fetchXGetURL(const char *URL, struct url_stat *us, const char *flags)
177 if ((u = fetchParseURL(URL)) == NULL)
187 * Attempt to parse the given URL; if successful, call fetchGet().
190 fetchGetURL(const char *URL, const char *flags)
192 return (fetchXGetURL(URL, NULL, flags));
196 * Attempt to parse the given URL; if successful, call fetchPut().
199 fetchPutURL(const char *URL, const char *flags)
204 if ((u = fetchParseURL(URL)) == NULL)
214 * Attempt to parse the given URL; if successful, call fetchStat().
217 fetchStatURL(const char *URL, struct url_stat *us, const char *flags)
222 if ((u = fetchParseURL(URL)) == NULL)
232 * Attempt to parse the given URL; if successful, call fetchList().
235 fetchListURL(const char *URL, const char *flags)
240 if ((u = fetchParseURL(URL)) == NULL)
250 * Make a URL
308 * Decode percent-encoded URL component from src into dst, stopping at end
335 * Split an URL into components. URL syntax is:
337 * This almost, but not quite, RFC1738 URL syntax.
340 fetchParseURL(const char *URL)
354 if ((p = strstr(URL, ":/"))) {
356 "%.*s", (int)(p - URL), URL);
357 URL = ++p;
362 if (URL[1] == '/')
363 URL = (p += 2);
365 p = URL;
367 if (!*URL || *URL == '/' || *URL == '.' ||
369 strchr(URL, '/') == NULL && strchr(URL, ':') == NULL))
372 p = strpbrk(URL, "/@");
375 q = fetch_pctdecode(u->user, URL, URL_USERLEN);
383 p = URL;
462 * Free a URL