version 1.76, 1999/10/08 15:33:33
|
version 1.77, 1999/10/12 12:26:58
|
Line 1543 STRING *url;
|
Line 1543 STRING *url;
|
STRING orig, dest, end; |
STRING orig, dest, end; |
|
|
CHAR_T used_sep; |
CHAR_T used_sep; |
|
ThotBool ddot_simplify; /* used to desactivate the double dot simplifcation: |
|
something/../ simplification in relative URLs when they start with a ../ */ |
|
|
|
|
if (!url || !*url) |
if (!url || !*url) |
Line 1557 STRING *url;
|
Line 1559 STRING *url;
|
used_sep = DIR_SEP; |
used_sep = DIR_SEP; |
} |
} |
|
|
|
/* should we simplify double dot? */ |
|
path = *url; |
|
if (*path == TEXT('.') && *(path + 1) == TEXT('.')) |
|
ddot_simplify = FALSE; |
|
else |
|
ddot_simplify = TRUE; |
|
|
/* Find any scheme name */ |
/* Find any scheme name */ |
if ((path = ustrstr(*url, TEXT("://"))) != NULL) |
if ((path = ustrstr(*url, TEXT("://"))) != NULL) |
{ |
{ |
Line 1604 STRING *url;
|
Line 1613 STRING *url;
|
p = path; |
p = path; |
while (p < end) |
while (p < end) |
{ |
{ |
|
/* if we're pointing to a char, it's safe to reactivate the ../ convertion */ |
|
if (!ddot_simplify && *p != TEXT('.') && *p != used_sep) |
|
ddot_simplify = TRUE; |
|
|
if (*p==used_sep) |
if (*p==used_sep) |
{ |
{ |
if (p > *url && *(p+1) == TEXT('.') && (*(p+2) == used_sep || !*(p+2))) |
if (p > *url && *(p+1) == TEXT('.') && (*(p+2) == used_sep || !*(p+2))) |
Line 1613 STRING *url;
|
Line 1626 STRING *url;
|
while ((*orig++ = *dest++)); /* Remove a used_sep and a dot*/ |
while ((*orig++ = *dest++)); /* Remove a used_sep and a dot*/ |
end = orig - 1; |
end = orig - 1; |
} |
} |
else if (*(p+1) == TEXT('.') && *(p+2) == TEXT('.') && (*(p+3) == used_sep || !*(p+3))) |
else if (ddot_simplify && *(p+1) == TEXT('.') && *(p+2) == TEXT('.') |
|
&& (*(p+3) == used_sep || !*(p+3))) |
{ |
{ |
newptr = p; |
newptr = p; |
while (newptr>path && *--newptr!=used_sep); /* prev used_sep */ |
while (newptr>path && *--newptr!=used_sep); /* prev used_sep */ |
Line 1649 STRING *url;
|
Line 1663 STRING *url;
|
/* |
/* |
** Check for host/../.. kind of things |
** Check for host/../.. kind of things |
*/ |
*/ |
if (*path == used_sep && *(path+1) == TEXT('.') && *(path+2) == TEXT('.') && (!*(path+3) || *(path+3) == used_sep)) |
if (*path == used_sep && *(path+1) == TEXT('.') && *(path+2) == TEXT('.') |
|
&& (!*(path+3) || *(path+3) == used_sep)) |
*(path+1) = EOS; |
*(path+1) = EOS; |
|
|
return; |
return; |