Subversion Repositories Kolibri OS

Rev

Rev 7742 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. void GetAbsoluteURL(dword in_URL)
  3. {
  4.         int i;
  5.         dword orig_URL = in_URL;
  6.         char newurl[sizeof(URL)];
  7.  
  8.         while (i=strstr(in_URL, "&"))
  9.         {
  10.                 strcpy(i+1, i+5);
  11.         }
  12.  
  13.         if (check_is_the_url_absolute(in_URL)) return;
  14.  
  15.         IF (!strncmp(in_URL,"//", 2))
  16.         {
  17.                 strcpy(#newurl, "http:");
  18.                 strcat(#newurl, in_URL);
  19.                 strcpy(orig_URL, #newurl);
  20.                 return;
  21.         }
  22.        
  23.         IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
  24.         if (!http.transfer)
  25.         {
  26.                 strcpy(#newurl, history.current());
  27.         }
  28.         else
  29.         {
  30.                 strcpy(#newurl, history.items.get(history.active-2));
  31.         }
  32.  
  33.         if (ESBYTE[in_URL] == '/') //remove everything after site domain name
  34.         {
  35.                 i = strchr(#newurl+8, '/');
  36.                 if (i) ESBYTE[i]=0;
  37.                 in_URL+=1;
  38.         }
  39.                
  40.         _CUT_ST_LEVEL_MARK:
  41.                
  42.         if (newurl[strrchr(#newurl, '/')-2]<>'/')
  43.         {
  44.                 newurl[strrchr(#newurl, '/')] = 0x00;
  45.         }
  46.        
  47.         IF (!strncmp(in_URL,"../",3))
  48.         {
  49.                 in_URL+=3;
  50.                 newurl[strrchr(#newurl, '/')-1] = 0x00;
  51.                 goto _CUT_ST_LEVEL_MARK;
  52.         }
  53.        
  54.         if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
  55.        
  56.         strcat(#newurl, in_URL);
  57.         strcpy(orig_URL, #newurl);
  58. }
  59.  
  60.