Subversion Repositories Kolibri OS

Rev

Rev 5631 | Rev 6001 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4163 hidnplayr 1
//HTTP library
5598 pavelyakov 2
#ifndef INCLUDE_LIBHTTP_H
3
#define INCLUDE_LIBHTTP_H
5676 pavelyakov 4
#print "[include ]\n"
4163 hidnplayr 5
 
5598 pavelyakov 6
#ifndef INCLUDE_KOLIBRI_H
7
#include "../lib/kolibri.h"
8
#endif
9
 
10
#ifndef INCLUDE_DLL_H
11
#include "../lib/dll.h"
12
#endif
13
 
5631 pavelyakov 14
dword NOT_INIT_LIBHTTP = true;
4165 hidnplayr 15
dword libHTTP = #alibHTTP;
16
char alibHTTP[23] = "/sys/lib/http.obj\0";
17
 
5576 pavelyakov 18
dword http_lib_init          = #aLib_init;
19
dword http_get               = #aHTTPget;
20
dword http_head              = #aHTTPhead;
21
dword http_post              = #aHTTPpost;
4235 leency 22
dword http_find_header_field = #aFHF;
5576 pavelyakov 23
dword http_send              = #aHTTPsend;
24
dword http_receive           = #aHTTPreceive;
25
dword http_disconnect        = #aHTTPdisconnect;
26
dword http_free              = #aHTTPfree;
27
dword uri_escape             = #aURIescape;
28
dword uri_unescape           = #aURIunescape;
4163 hidnplayr 29
$DD 2 dup 0
30
 
31
char aLib_init[9]              = "lib_init\0";
32
char aHTTPget[4]               = "get\0";
4235 leency 33
char aHTTPhead[5]              = "head\0";
34
char aHTTPpost[5]              = "post\0";
35
char aFHF[18]                  = "find_header_field\0";
5534 hidnplayr 36
char aHTTPsend[5]              = "send\0";
37
char aHTTPreceive[8]           = "receive\0";
38
char aHTTPdisconnect[11]       = "disconnect\0";
4235 leency 39
char aHTTPfree[5]              = "free\0";
40
char aURIescape[7]             = "escape\0";
41
char aURIunescape[9]           = "unescape\0";
4163 hidnplayr 42
 
5534 hidnplayr 43
// status flags
4163 hidnplayr 44
#define FLAG_HTTP11             1 << 0
45
#define FLAG_GOT_HEADER         1 << 1
4536 leency 46
#define FLAG_GOT_ALL_DATA       1 << 2
4163 hidnplayr 47
#define FLAG_CONTENT_LENGTH     1 << 3
48
#define FLAG_CHUNKED            1 << 4
4235 leency 49
#define FLAG_CONNECTED          1 << 5
4163 hidnplayr 50
 
5534 hidnplayr 51
// user flags
52
#define FLAG_KEEPALIVE          1 << 8
53
#define FLAG_MULTIBUFF			1 << 9
54
 
55
// error flags
4163 hidnplayr 56
#define FLAG_INVALID_HEADER     1 << 16
57
#define FLAG_NO_RAM             1 << 17
58
#define FLAG_SOCKET_ERROR       1 << 18
4235 leency 59
#define FLAG_TIMEOUT_ERROR      1 << 19
4536 leency 60
#define FLAG_TRANSFER_FAILED    1 << 20
4163 hidnplayr 61
 
62
struct  http_msg{
63
        dword   socket;
64
        dword   flags;
65
        dword   write_ptr;
66
        dword   buffer_length;
67
        dword   chunk_ptr;
4235 leency 68
        dword   timestamp;
4163 hidnplayr 69
        dword   status;
70
        dword   header_length;
4536 leency 71
		dword	content_ptr;
4163 hidnplayr 72
        dword   content_length;
4168 hidnplayr 73
        dword   content_received;
4536 leency 74
        char    http_header;
5576 pavelyakov 75
};
76
 
77
:dword file_get_contents(dword url,...)
78
{
79
	http_get(url,FLAG_HTTP11,"");
5598 pavelyakov 80
}
81
 
82
#endif