Lines Matching full:url

61 	{ URL_MALFORMED,	FETCH_URL,	"Malformed URL" },
62 { URL_BAD_SCHEME, FETCH_URL, "Invalid URL scheme" },
71 * Select the appropriate protocol for the URL scheme, and return a
72 * read-only stream connected to the document referenced by the URL.
76 fetchXGet(struct url *URL, struct url_stat *us, const char *flags) in fetchXGet() argument
83 if (strcmp(URL->scheme, SCHEME_FILE) == 0) in fetchXGet()
84 return (fetchXGetFile(URL, us, flags)); in fetchXGet()
85 else if (strcmp(URL->scheme, SCHEME_FTP) == 0) in fetchXGet()
86 return (fetchXGetFTP(URL, us, flags)); in fetchXGet()
87 else if (strcmp(URL->scheme, SCHEME_HTTP) == 0) in fetchXGet()
88 return (fetchXGetHTTP(URL, us, flags)); in fetchXGet()
89 else if (strcmp(URL->scheme, SCHEME_HTTPS) == 0) in fetchXGet()
90 return (fetchXGetHTTP(URL, us, flags)); in fetchXGet()
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) in fetchGet() argument
102 return (fetchXGet(URL, NULL, flags)); in fetchGet()
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) in fetchPut() argument
113 if (strcmp(URL->scheme, SCHEME_FILE) == 0) in fetchPut()
114 return (fetchPutFile(URL, flags)); in fetchPut()
115 else if (strcmp(URL->scheme, SCHEME_FTP) == 0) in fetchPut()
116 return (fetchPutFTP(URL, flags)); in fetchPut()
117 else if (strcmp(URL->scheme, SCHEME_HTTP) == 0) in fetchPut()
118 return (fetchPutHTTP(URL, flags)); in fetchPut()
119 else if (strcmp(URL->scheme, SCHEME_HTTPS) == 0) in fetchPut()
120 return (fetchPutHTTP(URL, flags)); in fetchPut()
126 * Select the appropriate protocol for the URL scheme, and return the
127 * size of the document referenced by the URL if it exists.
130 fetchStat(struct url *URL, struct url_stat *us, const char *flags) in fetchStat() argument
137 if (strcmp(URL->scheme, SCHEME_FILE) == 0) in fetchStat()
138 return (fetchStatFile(URL, us, flags)); in fetchStat()
139 else if (strcmp(URL->scheme, SCHEME_FTP) == 0) in fetchStat()
140 return (fetchStatFTP(URL, us, flags)); in fetchStat()
141 else if (strcmp(URL->scheme, SCHEME_HTTP) == 0) in fetchStat()
142 return (fetchStatHTTP(URL, us, flags)); in fetchStat()
143 else if (strcmp(URL->scheme, SCHEME_HTTPS) == 0) in fetchStat()
144 return (fetchStatHTTP(URL, us, flags)); in fetchStat()
150 * Select the appropriate protocol for the URL scheme, and return a
151 * list of files in the directory pointed to by the URL.
154 fetchList(struct url *URL, const char *flags) in fetchList() argument
157 if (strcmp(URL->scheme, SCHEME_FILE) == 0) in fetchList()
158 return (fetchListFile(URL, flags)); in fetchList()
159 else if (strcmp(URL->scheme, SCHEME_FTP) == 0) in fetchList()
160 return (fetchListFTP(URL, flags)); in fetchList()
161 else if (strcmp(URL->scheme, SCHEME_HTTP) == 0) in fetchList()
162 return (fetchListHTTP(URL, flags)); in fetchList()
163 else if (strcmp(URL->scheme, SCHEME_HTTPS) == 0) in fetchList()
164 return (fetchListHTTP(URL, flags)); in fetchList()
170 * Attempt to parse the given URL; if successful, call fetchXGet().
173 fetchXGetURL(const char *URL, struct url_stat *us, const char *flags) in fetchXGetURL() argument
175 struct url *u; in fetchXGetURL()
178 if ((u = fetchParseURL(URL)) == NULL) in fetchXGetURL()
188 * Attempt to parse the given URL; if successful, call fetchGet().
191 fetchGetURL(const char *URL, const char *flags) in fetchGetURL() argument
193 return (fetchXGetURL(URL, NULL, flags)); in fetchGetURL()
197 * Attempt to parse the given URL; if successful, call fetchPut().
200 fetchPutURL(const char *URL, const char *flags) in fetchPutURL() argument
202 struct url *u; in fetchPutURL()
205 if ((u = fetchParseURL(URL)) == NULL) in fetchPutURL()
215 * Attempt to parse the given URL; if successful, call fetchStat().
218 fetchStatURL(const char *URL, struct url_stat *us, const char *flags) in fetchStatURL() argument
220 struct url *u; in fetchStatURL()
223 if ((u = fetchParseURL(URL)) == NULL) in fetchStatURL()
233 * Attempt to parse the given URL; if successful, call fetchList().
236 fetchListURL(const char *URL, const char *flags) in fetchListURL() argument
238 struct url *u; in fetchListURL()
241 if ((u = fetchParseURL(URL)) == NULL) in fetchListURL()
251 * Make a URL
253 struct url *
257 struct url *u; in fetchMakeURL()
269 /* allocate struct url */ in fetchMakeURL()
310 * Decode percent-encoded URL component from src into dst, stopping at end
342 * Split an URL into components. URL syntax is:
344 * This almost, but not quite, RFC1738 URL syntax.
346 struct url *
347 fetchParseURL(const char *URL) in fetchParseURL() argument
351 struct url *u; in fetchParseURL()
354 /* allocate struct url */ in fetchParseURL()
362 if ((p = strstr(URL, ":/"))) { in fetchParseURL()
363 if (p - URL > URL_SCHEMELEN) in fetchParseURL()
365 for (i = 0; URL + i < p; i++) in fetchParseURL()
366 u->scheme[i] = tolower((unsigned char)URL[i]); in fetchParseURL()
367 URL = ++p; in fetchParseURL()
372 if (URL[1] == '/') in fetchParseURL()
373 URL = (p += 2); in fetchParseURL()
375 p = URL; in fetchParseURL()
377 if (!*URL || *URL == '/' || *URL == '.' || in fetchParseURL()
379 strchr(URL, '/') == NULL && strchr(URL, ':') == NULL)) in fetchParseURL()
382 p = strpbrk(URL, "/@"); in fetchParseURL()
385 q = fetch_pctdecode(u->user, URL, URL_USERLEN); in fetchParseURL()
397 p = URL; in fetchParseURL()
486 * Free a URL
489 fetchFreeURL(struct url *u) in fetchFreeURL()