Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5685 leency 1
 
2
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer;
3
4
 
5
6
 
7
enum { STATE_NOT_STARTED, STATE_IN_PROGRESS, STATE_COMPLETED };
8
9
 
10
 
11
 
12
 
13
{
14
	downloaded_size = full_size = 0;
15
}
16
17
 
18
{
19
	download_state = STATE_NOT_STARTED;
20
	if (DL_http_transfer<>0)
21
	{
22
		EAX = DL_http_transfer;
23
		EAX = EAX.http_msg.content_ptr;		// get pointer to data
24
		$push	EAX							// save it on the stack
25
		http_free stdcall (DL_http_transfer);	// abort connection
26
		$pop	EAX
27
		mem_Free(EAX);						// free data
28
		DL_http_transfer=0;
29
		DL_bufsize = 0;
30
		DL_bufpointer = mem_Free(DL_bufpointer);
31
		Downloading_SetDefaults();
32
	}
33
}
34
35
 
36
{
37
	download_state = STATE_IN_PROGRESS;
38
	http_get stdcall (#DL_URL, 0, 0, #accept_language);
39
	DL_http_transfer = EAX;
40
}
41
42
 
43
{
44
	ESI = DL_http_transfer;
45
	DL_bufpointer = ESI.http_msg.content_ptr;
46
	DL_bufsize = ESI.http_msg.content_received;
47
	http_free stdcall (DL_http_transfer);
48
	DL_http_transfer=0;
49
	download_state = STATE_COMPLETED;
50
}
51