2015-12-20 16:50:48 +01:00
|
|
|
|
2020-03-27 11:38:54 +01:00
|
|
|
dword GetAbsoluteURL(dword in_URL)
|
2015-12-20 16:50:48 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
dword orig_URL = in_URL;
|
2020-03-27 11:38:54 +01:00
|
|
|
char newurl[URL_SIZE+1];
|
2015-12-20 16:50:48 +01:00
|
|
|
|
|
|
|
while (i=strstr(in_URL, "&"))
|
|
|
|
{
|
|
|
|
strcpy(i+1, i+5);
|
|
|
|
}
|
|
|
|
|
2020-03-27 11:38:54 +01:00
|
|
|
if (check_is_the_url_absolute(in_URL)) return orig_URL;
|
2018-02-18 16:32:11 +01:00
|
|
|
|
2020-03-21 15:33:54 +01:00
|
|
|
IF (!strncmp(in_URL,"//", 2))
|
2018-02-18 16:32:11 +01:00
|
|
|
{
|
2020-03-25 01:18:19 +01:00
|
|
|
strcpy(#newurl, "http:");
|
|
|
|
strcat(#newurl, in_URL);
|
2018-02-18 16:32:11 +01:00
|
|
|
strcpy(orig_URL, #newurl);
|
2020-03-27 11:38:54 +01:00
|
|
|
return orig_URL;
|
2018-02-18 16:32:11 +01:00
|
|
|
}
|
2015-12-20 16:50:48 +01:00
|
|
|
|
2020-03-21 15:33:54 +01:00
|
|
|
IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
|
2018-05-18 22:18:10 +02:00
|
|
|
if (!http.transfer)
|
2015-12-20 16:50:48 +01:00
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
strcpy(#newurl, history.current());
|
2015-12-20 16:50:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
strcpy(#newurl, history.items.get(history.active-2));
|
2015-12-20 16:50:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ESBYTE[in_URL] == '/') //remove everything after site domain name
|
|
|
|
{
|
|
|
|
i = strchr(#newurl+8, '/');
|
|
|
|
if (i) ESBYTE[i]=0;
|
|
|
|
in_URL+=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
_CUT_ST_LEVEL_MARK:
|
|
|
|
|
|
|
|
if (newurl[strrchr(#newurl, '/')-2]<>'/')
|
|
|
|
{
|
|
|
|
newurl[strrchr(#newurl, '/')] = 0x00;
|
|
|
|
}
|
|
|
|
|
|
|
|
IF (!strncmp(in_URL,"../",3))
|
|
|
|
{
|
|
|
|
in_URL+=3;
|
|
|
|
newurl[strrchr(#newurl, '/')-1] = 0x00;
|
|
|
|
goto _CUT_ST_LEVEL_MARK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
|
|
|
|
|
|
|
|
strcat(#newurl, in_URL);
|
|
|
|
strcpy(orig_URL, #newurl);
|
2020-03-27 11:38:54 +01:00
|
|
|
return orig_URL;
|
2015-12-20 16:50:48 +01:00
|
|
|
}
|
|
|
|
|