HTMLv: 0.99.72: fix processing URLs which starts from '/', handle errors on wrong site URL

git-svn-id: svn://kolibrios.org@4646 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2014-03-15 10:23:06 +00:00
parent bddab0d593
commit 99f718a31d
3 changed files with 60 additions and 19 deletions

View File

@ -116,7 +116,7 @@ void TWebBrowser::GetNewUrl(){
if (URL[0] == '/')
{
i = strchr(#newurl+8, '/');
newurl[i+7]=0;
if (i>0) newurl[i+7]=0;
strcpy(#URL, #URL+1);
}
@ -142,12 +142,19 @@ void TWebBrowser::GetNewUrl(){
void BufEncode(int set_new_encoding)
{
int bufpointer_realsize;
cur_encoding = set_new_encoding;
if (o_bufpointer==0)
{
debugi(bufsize);
bufsize = strlen(bufpointer);
debugi(bufsize);
bufpointer_realsize = strlen(bufpointer);
if (bufpointer_realsize > bufsize)
{
debug("bufsize: ");
debugi(bufsize);
debug("bufpointer_realsize: ");
debugi(bufpointer_realsize);
bufsize = bufpointer_realsize;
}
o_bufpointer = malloc(bufsize);
strcpy(o_bufpointer, bufpointer);
}
@ -412,6 +419,10 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
DrawBuf.Fill(bg_color);
}
} while(GetNextParam());
if (opened)
{
if (cur_encoding==_DEFAULT) BufEncode(_UTF); //if no encoding specified it would be UTF
}
return;
}
@ -630,7 +641,7 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) meta_encoding = _KOI;
if (!strcmp(#options, "windows-1251")) || (!strcmp(#options, "windows1251")) meta_encoding = _WIN;
//if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) meta_encoding = _DOS;
if ((cur_encoding==_DEFAULT) && (http_transfer==0)) BufEncode(meta_encoding);
if (cur_encoding==_DEFAULT) BufEncode(meta_encoding);
return;
}
} while(GetNextParam());

View File

@ -30,14 +30,14 @@
#include "img\URLgoto.txt";
#ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.71";
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.72";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
unsigned char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n\0";
#else
char version[]=" Text-based Browser 0.99.71";
char version[]=" Text-based Browser 0.99.72";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";
@ -459,18 +459,15 @@ void ProcessLinks(int id)
void StopLoading()
{
if (http_transfer<>0)
{
EAX = http_transfer;
EAX = EAX.http_msg.content_ptr; // get pointer to data
$push EAX // save it on the stack
http_free stdcall (http_transfer); // abort connection
$pop EAX
mem_Free(EAX); // free data
http_transfer=0;
bufsize = 0;
PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
}
EAX = http_transfer;
EAX = EAX.http_msg.content_ptr; // get pointer to data
$push EAX // save it on the stack
http_free stdcall (http_transfer); // abort connection
$pop EAX
mem_Free(EAX); // free data
http_transfer=0;
bufsize = 0;
PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
}
void SetPageDefaults()
@ -495,6 +492,13 @@ void OpenPage()
_PutImage(88,10, 24,24, #stop_btn);
http_get stdcall (#URL, #accept_language);
http_transfer = EAX;
if (http_transfer == 0)
{
StopLoading();
bufsize = 0;
ShowPage();
return;
}
IF (http_transfer < 0) notify("Error from HTTP lib");
}
else

View File

@ -139,6 +139,12 @@ GETKEYII:
$shr eax,8
}
inline fastcall int GetFullKey()
{
$mov eax,2
$int 0x40
}
inline fastcall pause( EBX)
{
@ -362,6 +368,26 @@ DONE:
$pop eax
}
inline fastcall void debug( EDX)
{
$push eax
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
NEXT_CHAR:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz DONE
$int 0x40
$inc edx
$jmp NEXT_CHAR
DONE:
$pop ecx
$pop ebx
$pop eax
}
inline fastcall void debugch( ECX)
{