Home | History | Annotate | Download | only in libfetch

Lines Matching refs:URL

62 	{ URL_MALFORMED,	FETCH_URL,	"Malformed URL" },
63 { URL_BAD_SCHEME, FETCH_URL, "Invalid URL scheme" },
72 * Select the appropriate protocol for the URL scheme, and return a
73 * read-only stream connected to the document referenced by the URL.
77 fetchXGet(struct url *URL, struct url_stat *us, const char *flags)
83 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
84 return (fetchXGetFile(URL, us, flags));
85 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
86 return (fetchXGetFTP(URL, us, flags));
87 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
88 return (fetchXGetHTTP(URL, us, flags));
89 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
90 return (fetchXGetHTTP(URL, us, flags));
96 * Select the appropriate protocol for the URL scheme, and return a
97 * read-only stream connected to the document referenced by the URL.
100 fetchGet(struct url *URL, const char *flags)
102 return (fetchXGet(URL, NULL, flags));
106 * Select the appropriate protocol for the URL scheme, and return a
107 * write-only stream connected to the document referenced by the URL.
110 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)
135 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
136 return (fetchStatFile(URL, us, flags));
137 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
138 return (fetchStatFTP(URL, us, flags));
139 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
140 return (fetchStatHTTP(URL, us, flags));
141 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
142 return (fetchStatHTTP(URL, us, flags));
148 * Select the appropriate protocol for the URL scheme, and return a
149 * list of files in the directory pointed to by the URL.
152 fetchList(struct url *URL, const char *flags)
154 if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
155 return (fetchListFile(URL, flags));
156 else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
157 return (fetchListFTP(URL, flags));
158 else if (strcasecmp(URL->scheme, SCHEME_HTTP) == 0)
159 return (fetchListHTTP(URL, flags));
160 else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
161 return (fetchListHTTP(URL, flags));
167 * Attempt to parse the given URL; if successful, call fetchXGet().
170 fetchXGetURL(const char *URL, struct url_stat *us, const char *flags)
172 struct url *u;
175 if ((u = fetchParseURL(URL)) == NULL)
185 * Attempt to parse the given URL; if successful, call fetchGet().
188 fetchGetURL(const char *URL, const char *flags)
190 return (fetchXGetURL(URL, NULL, flags));
194 * Attempt to parse the given URL; if successful, call fetchPut().
197 fetchPutURL(const char *URL, const char *flags)
199 struct url *u;
202 if ((u = fetchParseURL(URL)) == NULL)
212 * Attempt to parse the given URL; if successful, call fetchStat().
215 fetchStatURL(const char *URL, struct url_stat *us, const char *flags)
217 struct url *u;
220 if ((u = fetchParseURL(URL)) == NULL)
230 * Attempt to parse the given URL; if successful, call fetchList().
233 fetchListURL(const char *URL, const char *flags)
235 struct url *u;
238 if ((u = fetchParseURL(URL)) == NULL)
248 * Make a URL
250 struct url *
254 struct url *u;
266 /* allocate struct url */
290 * Split an URL into components. URL syntax is:
292 * This almost, but not quite, RFC1738 URL syntax.
294 struct url *
295 fetchParseURL(const char *URL)
299 struct url *u;
302 /* allocate struct url */
309 if ((p = strstr(URL, ":/")) != NULL) {
311 "%.*s", (int)(p - URL), URL);
312 URL = ++p;
317 if (URL[1] == '/')
318 URL = (p += 2);
320 p = URL;
322 if (!*URL || *URL == '/' || *URL == '.' ||
324 strchr(URL, '/') == NULL && strchr(URL, ':') == NULL))
327 p = strpbrk(URL, "/@");
330 for (q = URL, i = 0; (*q != ':') && (*q != '@'); q++)
342 p = URL;
421 * Free a URL
424 fetchFreeURL(struct url *u)