Subversion Repositories Kolibri OS

Rev

Rev 7281 | 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 (!strcmpn(in_URL,"//", 2))
  16.         {
  17.                 //strcpy(#newurl, "http:");
  18.                 //strcat(#newurl, in_URL);
  19.                 sprintf(#newurl, "http:%s", in_URL);
  20.                 strcpy(orig_URL, #newurl);
  21.                 return;
  22.         }
  23.        
  24.         IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
  25.         if (!http.transfer)
  26.         {
  27.                 strcpy(#newurl, history.current());
  28.         }
  29.         else
  30.         {
  31.                 strcpy(#newurl, history.items.get(history.active-2));
  32.         }
  33.  
  34.         if (ESBYTE[in_URL] == '/') //remove everything after site domain name
  35.         {
  36.                 i = strchr(#newurl+8, '/');
  37.                 if (i) ESBYTE[i]=0;
  38.                 in_URL+=1;
  39.         }
  40.                
  41.         _CUT_ST_LEVEL_MARK:
  42.                
  43.         if (newurl[strrchr(#newurl, '/')-2]<>'/')
  44.         {
  45.                 newurl[strrchr(#newurl, '/')] = 0x00;
  46.         }
  47.        
  48.         IF (!strncmp(in_URL,"../",3))
  49.         {
  50.                 in_URL+=3;
  51.                 newurl[strrchr(#newurl, '/')-1] = 0x00;
  52.                 goto _CUT_ST_LEVEL_MARK;
  53.         }
  54.        
  55.         if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
  56.        
  57.         strcat(#newurl, in_URL);
  58.         strcpy(orig_URL, #newurl);
  59. }
  60.  
  61.