2013-11-04 20:11:00 +01:00
|
|
|
//HTTP library
|
|
|
|
|
2013-11-04 23:28:17 +01:00
|
|
|
dword libHTTP = #alibHTTP;
|
|
|
|
char alibHTTP[23] = "/sys/lib/http.obj\0";
|
|
|
|
|
2013-11-04 20:11:00 +01:00
|
|
|
dword http_lib_init = #aLib_init;
|
|
|
|
dword http_get = #aHTTPget;
|
2013-11-11 19:07:59 +01:00
|
|
|
dword http_head = #aHTTPhead;
|
|
|
|
dword http_post = #aHTTPpost;
|
|
|
|
dword http_find_header_field = #aFHF;
|
2013-11-04 20:11:00 +01:00
|
|
|
dword http_process = #aHTTPprocess;
|
2013-11-11 19:07:59 +01:00
|
|
|
dword http_free = #aHTTPfree;
|
|
|
|
dword http_stop = #aHTTPstop;
|
|
|
|
dword uri_escape = #aURIescape;
|
|
|
|
dword uri_unescape = #aURIunescape;
|
2013-11-04 20:11:00 +01:00
|
|
|
$DD 2 dup 0
|
|
|
|
|
|
|
|
char aLib_init[9] = "lib_init\0";
|
|
|
|
char aHTTPget[4] = "get\0";
|
2013-11-11 19:07:59 +01:00
|
|
|
char aHTTPhead[5] = "head\0";
|
|
|
|
char aHTTPpost[5] = "post\0";
|
|
|
|
char aFHF[18] = "find_header_field\0";
|
2013-11-04 20:11:00 +01:00
|
|
|
char aHTTPprocess[8] = "process\0";
|
2013-11-11 19:07:59 +01:00
|
|
|
char aHTTPfree[5] = "free\0";
|
|
|
|
char aHTTPstop[5] = "stop\0";
|
|
|
|
char aURIescape[7] = "escape\0";
|
|
|
|
char aURIunescape[9] = "unescape\0";
|
2013-11-04 20:11:00 +01:00
|
|
|
|
|
|
|
#define FLAG_HTTP11 1 << 0
|
|
|
|
#define FLAG_GOT_HEADER 1 << 1
|
|
|
|
#define FLAG_GOT_DATA 1 << 2
|
|
|
|
#define FLAG_CONTENT_LENGTH 1 << 3
|
|
|
|
#define FLAG_CHUNKED 1 << 4
|
2013-11-11 19:07:59 +01:00
|
|
|
#define FLAG_CONNECTED 1 << 5
|
2013-11-04 20:11:00 +01:00
|
|
|
|
2013-11-04 23:28:17 +01:00
|
|
|
// error flags go into the upper word
|
2013-11-04 20:11:00 +01:00
|
|
|
#define FLAG_INVALID_HEADER 1 << 16
|
|
|
|
#define FLAG_NO_RAM 1 << 17
|
|
|
|
#define FLAG_SOCKET_ERROR 1 << 18
|
2013-11-11 19:07:59 +01:00
|
|
|
#define FLAG_TIMEOUT_ERROR 1 << 19
|
2013-11-04 20:11:00 +01:00
|
|
|
|
|
|
|
struct http_msg{
|
|
|
|
dword socket;
|
|
|
|
dword flags;
|
|
|
|
dword write_ptr;
|
|
|
|
dword buffer_length;
|
|
|
|
dword chunk_ptr;
|
2013-11-11 19:07:59 +01:00
|
|
|
dword timestamp;
|
2013-11-04 20:11:00 +01:00
|
|
|
dword status;
|
|
|
|
dword header_length;
|
|
|
|
dword content_length;
|
2013-11-05 18:02:59 +01:00
|
|
|
dword content_received;
|
2013-11-04 23:28:17 +01:00
|
|
|
char data;
|
2013-11-04 20:11:00 +01:00
|
|
|
};
|