Subversion Repositories Kolibri OS

Rev

Rev 5990 | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. int UrlIsAbsolute(dword in)
  3. {
  4.         if(!strncmp(in,"http:",5)) return true;
  5.         if(!strncmp(in,"https:",6)) return true;
  6.         if(!strncmp(in,"mailto:",7)) return true;
  7.         if(!strncmp(in,"ftp:",4)) return true;
  8.         if(!strncmp(in,"WebView:",8)) return true;
  9.         if(!strncmp(in,"/sys/",5)) return true;
  10.         if(!strncmp(in,"/hd/",4)) return true;
  11.         if(!strncmp(in,"/fd/",4)) return true;
  12.         if(!strncmp(in,"/rd/",4)) return true;
  13.         if(!strncmp(in,"/tmp/",5)) return true;
  14.         if(!strncmp(in,"/cd/",4)) return true;
  15.         if(!strncmp(in,"/bd/",4)) return true;
  16.         if(!strncmp(in,"/usbhd/",7)) return true;
  17.         if(!strncmp(in,"/kolibrios/",11)) return true;
  18.         return false;
  19. }
  20.  
  21. void GetAbsoluteURL(dword in_URL)
  22. {
  23.         int i;
  24.         dword orig_URL = in_URL;
  25.         char newurl[sizeof(URL)];
  26.  
  27.         while (i=strstr(in_URL, "&"))
  28.         {
  29.                 strcpy(i+1, i+5);
  30.         }
  31.  
  32.         if (UrlIsAbsolute(in_URL)) return;
  33.        
  34.         IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
  35.         if (!http_transfer)
  36.         {
  37.                 strcpy(#newurl, history.current());
  38.         }
  39.         else
  40.         {
  41.                 strcpy(#newurl, history.items.get(history.active-2));
  42.         }
  43.  
  44.         if (ESBYTE[in_URL] == '/') //remove everything after site domain name
  45.         {
  46.                 i = strchr(#newurl+8, '/');
  47.                 if (i) ESBYTE[i]=0;
  48.                 in_URL+=1;
  49.         }
  50.                
  51.         _CUT_ST_LEVEL_MARK:
  52.                
  53.         if (newurl[strrchr(#newurl, '/')-2]<>'/')
  54.         {
  55.                 newurl[strrchr(#newurl, '/')] = 0x00;
  56.         }
  57.        
  58.         IF (!strncmp(in_URL,"../",3))
  59.         {
  60.                 in_URL+=3;
  61.                 newurl[strrchr(#newurl, '/')-1] = 0x00;
  62.                 goto _CUT_ST_LEVEL_MARK;
  63.         }
  64.        
  65.         if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
  66.        
  67.         strcat(#newurl, in_URL);
  68.         strcpy(orig_URL, #newurl);
  69. }
  70.  
  71.