kolibrios-gitea/programs/cmm/TWB/absolute_url.h
Kirill Lipatov (Leency) 873fc290d5 WebView 1.8:
1. possibility to open HTTPS sites via gate.aspero.pro (invisible for user), not working for files
2. rewrite parse tag function to fix broken URLs on page in some cases ("/user" instead of "/user/")
3. fix hand cursor appearance, fix progress bar on page load
4. load homepage on submitting empty url in adressbox
5. F12 - debug on, F11 - old tag parser on
6. unify page/file downloading code

git-svn-id: svn://kolibrios.org@7282 a494cfbc-eb01-0410-851d-a64ba20cac60
2018-05-20 13:40:58 +00:00

61 lines
1.1 KiB
C

void GetAbsoluteURL(dword in_URL)
{
int i;
dword orig_URL = in_URL;
char newurl[sizeof(URL)];
while (i=strstr(in_URL, "&"))
{
strcpy(i+1, i+5);
}
if (check_is_the_url_absolute(in_URL)) return;
IF (!strcmpn(in_URL,"//", 2))
{
//strcpy(#newurl, "http:");
//strcat(#newurl, in_URL);
sprintf(#newurl, "http:%s", in_URL);
strcpy(orig_URL, #newurl);
return;
}
IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
if (!http.transfer)
{
strcpy(#newurl, history.current());
}
else
{
strcpy(#newurl, history.items.get(history.active-2));
}
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);
}