revert template
git-svn-id: svn://kolibrios.org@9363 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2df395b5e3
commit
3d0a43f8a9
@ -1,82 +1,27 @@
|
|||||||
#define MEMSIZE 1024*100
|
#define MEMSIZE 4096*40
|
||||||
|
|
||||||
#include "../lib/kolibri.h"
|
|
||||||
#include "../lib/collection.h"
|
|
||||||
#include "../lib/gui.h"
|
#include "../lib/gui.h"
|
||||||
#include "../lib/fs.h"
|
#include "../lib/fs.h"
|
||||||
|
|
||||||
#include "../lib/obj/http.h"
|
|
||||||
#include "../lib/obj/console.h"
|
|
||||||
|
|
||||||
collection links;
|
|
||||||
#include "urls.h"
|
|
||||||
|
|
||||||
_http http;
|
|
||||||
char accept_language[]= "Accept-Language: en\n";
|
|
||||||
|
|
||||||
int url_id=0;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
char savepath[100];
|
proc_info Form;
|
||||||
load_dll(libHTTP, #http_lib_init,1);
|
|
||||||
load_dll(libConsole, #con_init, 0);
|
|
||||||
|
|
||||||
con_init stdcall (70, 40, 70, 1020, "Web stability test");
|
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE);
|
||||||
urls_add();
|
loop() switch(WaitEvent())
|
||||||
con_write_asciiz stdcall ("Redirect is not handled yet.\n");
|
|
||||||
con_write_asciiz stdcall ("All pages are saved into /tmp0/1\n\n");
|
|
||||||
con_write_asciiz stdcall ("Downloading pages...\n\n");
|
|
||||||
pause(100);
|
|
||||||
get_next_url();
|
|
||||||
|
|
||||||
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
|
|
||||||
loop() switch(@WaitEventTimeout(200))
|
|
||||||
{
|
{
|
||||||
case evNetwork:
|
case evMouse:
|
||||||
if (!http.receive_result) {
|
mouse.get();
|
||||||
sprintf(#savepath, "/tmp0/1/%s.htm", links.get(url_id)+7);
|
break;
|
||||||
CreateFile(http.content_received, http.content_pointer, #savepath);
|
|
||||||
free(http.content_pointer);
|
case evKey:
|
||||||
http_free stdcall (http.transfer);
|
@GetKeyScancode();
|
||||||
http.transfer=0;
|
if (AL == SCAN_CODE_ESC) @ExitProcess();
|
||||||
con_write_asciiz stdcall ("\n");
|
break;
|
||||||
get_next_url();
|
|
||||||
}
|
case evReDraw:
|
||||||
if (http.transfer) {
|
sc.get();
|
||||||
http.receive();
|
DefineAndDrawWindow(100, 100, 300, 250, 0x34, sc.work, "Template app", 0);
|
||||||
} else {
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
con_write_asciiz stdcall (" => FAILED\n");
|
|
||||||
get_next_url();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void get_next_url()
|
|
||||||
{
|
|
||||||
char get_url[2500];
|
|
||||||
dword url;
|
|
||||||
|
|
||||||
url_id++;
|
|
||||||
url = links.get(url_id);
|
|
||||||
|
|
||||||
if (!url) {
|
|
||||||
con_write_asciiz stdcall ("Download complete.");
|
|
||||||
con_exit stdcall (0);
|
|
||||||
ExitProcess();
|
|
||||||
} else {
|
|
||||||
con_write_asciiz stdcall (itoa(url_id));
|
|
||||||
con_write_asciiz stdcall (". ");
|
|
||||||
con_write_asciiz stdcall (links.get(url_id));
|
|
||||||
|
|
||||||
if (!strncmp(url,"https:",6)) {
|
|
||||||
sprintf(#get_url, "http://gate.aspero.pro/?site=%s", url);
|
|
||||||
} else if (!strncmp(url,"http:",5)) {
|
|
||||||
sprintf(#get_url, "%s", url);
|
|
||||||
} else {
|
|
||||||
get_next_url();
|
|
||||||
}
|
|
||||||
|
|
||||||
http.get(#get_url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user