forked from KolibriOS/kolibrios
WebView 3.01: bugfixes (thanks Mihail Serebryakov and rgimad for reports), refactor URL parse
git-svn-id: svn://kolibrios.org@8410 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e63d25e33e
commit
feeb972821
@ -189,7 +189,6 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
}
|
||||
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
||||
{
|
||||
//bukva = ESBYTE[bufpos];
|
||||
switch (ESBYTE[bufpos])
|
||||
{
|
||||
case 0x0a:
|
||||
@ -212,8 +211,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
case '&': // and so on
|
||||
for (j=1, unicode_symbol=0; (ESBYTE[bufpos+j]<>';') && (!__isWhite(ESBYTE[bufpos+j])) && (j<8); j++)
|
||||
{
|
||||
bukva = ESBYTE[bufpos+j];
|
||||
chrcat(#unicode_symbol, bukva);
|
||||
chrcat(#unicode_symbol, ESBYTE[bufpos+j]);
|
||||
}
|
||||
if (GetUnicodeSymbol(#line, #unicode_symbol, sizeof(line)-1)) {
|
||||
bufpos += j;
|
||||
@ -228,6 +226,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
switch (ESBYTE[bufpos]) {
|
||||
case '!':
|
||||
case '/':
|
||||
case '?':
|
||||
case 'a'...'z':
|
||||
case 'A'...'Z':
|
||||
goto _TAG;
|
||||
|
@ -41,7 +41,7 @@
|
||||
// DATA //
|
||||
// //
|
||||
//===================================================//
|
||||
char version[]="WebView 3 GOLD";
|
||||
char version[]="WebView 3.01";
|
||||
|
||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||
|
||||
@ -593,7 +593,6 @@ bool EventClickAnchor()
|
||||
|
||||
if (anchors.get_pos_by_name(aURL+1)!=-1) {
|
||||
WB1.list.first = anchors.get_pos_by_name(aURL+1);
|
||||
//WB1.list.CheckDoesValuesOkey();
|
||||
strcpy(#editURL, history.current());
|
||||
strcat(#editURL, aURL);
|
||||
DrawOmnibox();
|
||||
|
@ -101,7 +101,7 @@ dword _http::get(dword _url)
|
||||
cur_url = _url;
|
||||
http_get stdcall (_url, 0, 0, #accept_language);
|
||||
transfer = EAX;
|
||||
return transfer;
|
||||
return EAX;
|
||||
}
|
||||
|
||||
void _http::hfree()
|
||||
@ -203,41 +203,39 @@ void _http::receive()
|
||||
|
||||
while (i=strstr(new_URL, "&")) strcpy(i+1, i+5);
|
||||
|
||||
if (check_is_the_url_absolute(new_URL)) return orig_URL;
|
||||
if (check_is_the_url_absolute(new_URL)) return new_URL;
|
||||
|
||||
IF (!strncmp(new_URL,"//", 2))
|
||||
{
|
||||
strncpy(#newurl, "http:", URL_SIZE);
|
||||
strncat(#newurl, new_URL, URL_SIZE);
|
||||
strncpy(orig_URL, #newurl, URL_SIZE);
|
||||
return orig_URL;
|
||||
switch(ESBYTE[new_URL]) {
|
||||
case '.':
|
||||
new_URL++;
|
||||
if (ESBYTE[new_URL] == '/') {
|
||||
new_URL++;
|
||||
}
|
||||
else if (ESBYTE[new_URL] == '.') && (ESBYTE[new_URL+1] == '/') {
|
||||
_GO_UP:
|
||||
new_URL+=2;
|
||||
newurl[strrchr(#newurl, '/')-1] = '\0';
|
||||
}
|
||||
goto _DEFAULT;
|
||||
case '?':
|
||||
strchr(#newurl+8, '?'); //returns EAX
|
||||
if (EAX) ESBYTE[EAX] = '\0';
|
||||
break;
|
||||
case '/':
|
||||
new_URL++;
|
||||
if (ESBYTE[new_URL] == '/') {
|
||||
strcpy(#newurl, "http:/");
|
||||
break;
|
||||
}
|
||||
EAX = strchr(#newurl+8, '/');
|
||||
if (EAX) ESBYTE[EAX] = '\0';
|
||||
default:
|
||||
_DEFAULT:
|
||||
EAX = strrchr(#newurl, '/');
|
||||
if (newurl[EAX-2]!='/') newurl[EAX] = '\0';
|
||||
if (!strncmp(new_URL,"../",3)) goto _GO_UP;
|
||||
if (newurl[strlen(#newurl)-1]!='/') strncat(#newurl, "/", URL_SIZE);
|
||||
}
|
||||
|
||||
IF (!strncmp(new_URL,"./", 2)) new_URL+=2;
|
||||
|
||||
if (ESBYTE[new_URL] == '/') //remove everything after site domain name
|
||||
{
|
||||
i = strchr(#newurl+8, '/');
|
||||
if (i) ESBYTE[i]=0;
|
||||
new_URL+=1;
|
||||
}
|
||||
|
||||
_CUT_ST_LEVEL_MARK:
|
||||
|
||||
if (newurl[strrchr(#newurl, '/')-2]<>'/')
|
||||
{
|
||||
newurl[strrchr(#newurl, '/')] = 0x00;
|
||||
}
|
||||
|
||||
IF (!strncmp(new_URL,"../",3))
|
||||
{
|
||||
new_URL+=3;
|
||||
newurl[strrchr(#newurl, '/')-1] = 0x00;
|
||||
goto _CUT_ST_LEVEL_MARK;
|
||||
}
|
||||
|
||||
if (newurl[strlen(#newurl)-1]<>'/') strncat(#newurl, "/", URL_SIZE);
|
||||
|
||||
strncat(#newurl, new_URL, URL_SIZE);
|
||||
strncpy(orig_URL, #newurl, URL_SIZE);
|
||||
return orig_URL;
|
||||
|
Loading…
Reference in New Issue
Block a user