300
/* non-FTP URLs are always browsable. FTP URLs are browsable if they end with
303
isBrowseableURL(const char *url)
306
return (!memEqualCI(url, "ftp://", 6)) || (url[strlen(url) - 1] == '/');
309
} /* isBrowseableURL */
300
311
/* Helper functions to return pieces of the URL.
301
312
* Makes a copy, so you can have your 0 on the end.
302
313
* Return 0 for an error, and "" if that piece is missing. */
491
502
return ((url[0] | 0x20) == 'p');
494
/* Don't let a web page fetch itself. */
495
static char *histURL[MAXFETCH];
496
static int histFrom[MAXFETCH];
499
fetchHistory(const char *prev, const char *next)
503
/* zero is a reset */
504
debugPrint(4, "fetch hist %s : %s", prev, next);
506
for(i = 0; i < n_fetch; ++i)
512
if(memEqualCI(prev, "http://", 7))
514
for(i = 0; i < n_fetch; ++i)
515
if(stringEqual(prev, histURL[i])) {
520
if(n_fetch >= MAXFETCH) {
521
setError(MSG_WebFetchMany);
524
/* Have we seen this one before? */
525
if(memEqualCI(next, "http://", 7))
527
for(i = 0; i < n_fetch; ++i)
528
if(stringEqual(next, histURL[i]))
530
if(i == n_fetch) { /* new */
531
histURL[i] = cloneString(next);
536
/* Oops, we've already fetched this page. */
537
while(from >= 0 && from != i)
538
from = histFrom[from];
541
setError(MSG_WebFetchSelf);
554
506
squashDirectories(char *url)