Subversion Repositories Kolibri OS

Rev

Rev 4986 | Rev 5534 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4986 Rev 4996
1
get(*url, *add_header);
1
get(*url, *add_header);
2
	*url = pointer to ASCIIZ URL
2
	*url = pointer to ASCIIZ URL
3
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.
3
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.
4
			Every additional parameter must end with CR LF bytes, including the last line.
4
			Every additional parameter must end with CR LF bytes, including the last line.
5
Initiates a HTTP connection, using 'GET' method.
5
Initiates a HTTP connection, using 'GET' method.
6
 - returns 0 on error, identifier otherwise.
6
 - returns 0 on error, identifier otherwise.
7
 
7
 
8
head(*url, *add_header);
8
head(*url, *add_header);
9
	*url = pointer to ASCIIZ URL
9
	*url = pointer to ASCIIZ URL
10
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.	
10
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.	
11
			Every additional parameter must end with CR LF bytes, including the last line.	
11
			Every additional parameter must end with CR LF bytes, including the last line.	
12
Initiate a HTTP connection, using 'HEAD' method.
12
Initiate a HTTP connection, using 'HEAD' method.
13
 - returns 0 on error, identifier otherwise
13
 - returns 0 on error, identifier otherwise
14
 
14
 
15
post(*url, *add_header, *content-type, content-length);
15
post(*url, *add_header, *content-type, content-length);
16
	*url = pointer to ASCIIZ URL
16
	*url = pointer to ASCIIZ URL
17
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.	
17
	*add_header = pointer to ASCIIZ additional header parameters, or null for none.	
18
			Every additional parameter must end with CR LF bytes, including the last line.
18
			Every additional parameter must end with CR LF bytes, including the last line.
19
	*content-type = pointer to ASCIIZ string containing content type.
19
	*content-type = pointer to ASCIIZ string containing content type.
20
	content-length = length of the content (in bytes).
20
	content-length = length of the content (in bytes).
21
Initiate a HTTP connection, using 'POST' method.
21
Initiate a HTTP connection, using 'POST' method.
22
The content itself must be send to the socket (which you can find in the structure),
22
The content itself must be send to the socket (which you can find in the structure),
23
using system function 75, 6.
23
using system function 75, 6.
24
 - returns 0 on error, identifier otherwise
24
 - returns 0 on error, identifier otherwise
25
 
25
 
26
process(identifier);
26
receive(identifier);
27
	identifier = identifier which one of the previous functions returned
27
	identifier = identifier which one of the previous functions returned
28
This procedure will handle all incoming data for a connection and place it in the buffer.
28
This procedure will handle all incoming data for a connection and place it in the buffer.
29
As long as the procedure expects more data, -1 is returned and the procedure must be called again.
29
As long as the procedure expects more data, -1 is returned and the procedure must be called again.
30
 - When transfer is done, the procedure will return 0. 
30
 - When transfer is done, the procedure will return 0. 
31
 
31
 
32
The HTTP header is placed together with some flags and other attributes in the http_msg structure.
32
The HTTP header is placed together with some flags and other attributes in the http_msg structure.
33
This structure is defined in http.inc (and not copied here because it might still change.)
33
This structure is defined in http.inc (and not copied here because it might still change.)
34
The identifier used by the functions is actually a pointer to this structure.
34
The identifier used by the functions is actually a pointer to this structure.
35
In the dword named .flags, the library will set various bit-flags indicating the status of the process.
35
In the dword named .flags, the library will set various bit-flags indicating the status of the process.
36
(When a transfer is done, one should check these bit-flags to find out if the transfer was error-free.)
36
(When a transfer is done, one should check these bit-flags to find out if the transfer was error-free.)
37
The HTTP header is placed at the end of this structure. The content is placed in another buffer.
37
The HTTP header is placed at the end of this structure. The content is placed in another buffer.
38
The dword .status contains the status code received from the server (e.g. 200 for OK).
38
The dword .status contains the status code received from the server (e.g. 200 for OK).
39
In header_length you'll find the length of the header as soon as it has been received.
39
In header_length you'll find the length of the header as soon as it has been received.
40
In content_ptr you'll find a pointer to the actual content.
40
In content_ptr you'll find a pointer to the actual content.
41
In content_length you'll find the length of the content. 
41
In content_length you'll find the length of the content. 
42
In content_received, you'll find the number of content bytes already received.
42
In content_received, you'll find the number of content bytes already received.
43
 
43
 
-
 
44
send(identifier, *dataptr, datalength);
-
 
45
	identifier = identifier which one of the previous functions returned
-
 
46
	*dataptr = pointer to the data you want to send
-
 
47
	datalength = length of the data to send (in bytes)
-
 
48
This procedure can be used to send data to the server (POST)
-
 
49
 - returns number of bytes sent, -1 on error
-
 
50
 
44
All procedures are non blocking!
51
All procedures are non blocking!
45
52