HTMLv: fix history for redirects

git-svn-id: svn://kolibrios.org@4563 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2014-02-09 15:19:23 +00:00
parent e5380bd32b
commit 81a3ec383b

View File

@ -43,7 +43,7 @@
unsigned char page_not_found[] = FROM "html\page_not_found_en.htm"; unsigned char page_not_found[] = FROM "html\page_not_found_en.htm";
#endif #endif
byte native_http=0; byte native_http=1;
proc_info Form; proc_info Form;
#define WIN_W 640 #define WIN_W 640
@ -187,9 +187,11 @@ void main()
if (EAX == 0) { if (EAX == 0) {
ESI = http_transfer; ESI = http_transfer;
// Handle redirects // Handle redirects
if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400) { if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
{
redirected++; redirected++;
if (redirected<=5) { if (redirected<=5)
{
http_find_header_field stdcall (http_transfer, #str_location); http_find_header_field stdcall (http_transfer, #str_location);
if (EAX!=0) { if (EAX!=0) {
ESI = EAX; ESI = EAX;
@ -200,20 +202,28 @@ void main()
} while (AL != 0) && (AL != 13) && (AL != 10)); } while (AL != 0) && (AL != 13) && (AL != 10));
DSBYTE[EDI-1]='\0'; DSBYTE[EDI-1]='\0';
} }
} else { }
else
{
//TODO: display error (too many redirects) //TODO: display error (too many redirects)
} }
} else { }
else
{
redirected = 0; redirected = 0;
} }
// Loading the page is complete, free resources // Loading the page is complete, free resources
http_free stdcall (http_transfer); http_free stdcall (http_transfer);
http_transfer=0; http_transfer=0;
if (redirected>0) { if (redirected>0)
{
WB1.GetNewUrl(); WB1.GetNewUrl();
strcpy(#editURL, #URL); strcpy(#editURL, #URL);
BrowserHistory.current--;
OpenPage(); OpenPage();
} else { }
else
{
Draw_Window(); // stop button => refresh button Draw_Window(); // stop button => refresh button
} }
} }