2015-07-22 20:32:54 +02:00
|
|
|
#ifndef INCLUDE_LIBHTTP_H
|
|
|
|
#define INCLUDE_LIBHTTP_H
|
2015-12-26 02:32:07 +01:00
|
|
|
#print "[include <obj/http.h]\n"
|
2015-07-22 20:32:54 +02:00
|
|
|
|
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INCLUDE_DLL_H
|
|
|
|
#include "../lib/dll.h"
|
|
|
|
#endif
|
2013-11-04 20:11:00 +01:00
|
|
|
|
2013-11-04 23:28:17 +01:00
|
|
|
dword libHTTP = #alibHTTP;
|
2015-12-26 02:32:07 +01:00
|
|
|
char alibHTTP[] = "/sys/lib/http.obj";
|
2013-11-04 23:28:17 +01:00
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
dword http_lib_init = #aLib_init;
|
|
|
|
dword http_get = #aHTTPget;
|
|
|
|
dword http_head = #aHTTPhead;
|
|
|
|
dword http_post = #aHTTPpost;
|
2013-11-15 20:52:54 +01:00
|
|
|
dword http_find_header_field = #aFHF;
|
2015-07-16 03:44:30 +02:00
|
|
|
dword http_send = #aHTTPsend;
|
|
|
|
dword http_receive = #aHTTPreceive;
|
|
|
|
dword http_disconnect = #aHTTPdisconnect;
|
|
|
|
dword http_free = #aHTTPfree;
|
|
|
|
dword uri_escape = #aURIescape;
|
|
|
|
dword uri_unescape = #aURIunescape;
|
2013-11-04 20:11:00 +01:00
|
|
|
$DD 2 dup 0
|
|
|
|
|
2015-12-26 02:32:07 +01:00
|
|
|
char aLib_init[] = "lib_init";
|
|
|
|
char aHTTPget[] = "get";
|
|
|
|
char aHTTPhead[] = "head";
|
|
|
|
char aHTTPpost[] = "post";
|
|
|
|
char aFHF[] = "find_header_field";
|
|
|
|
char aHTTPsend[] = "send";
|
|
|
|
char aHTTPreceive[] = "receive";
|
|
|
|
char aHTTPdisconnect[] = "disconnect";
|
|
|
|
char aHTTPfree[] = "free";
|
|
|
|
char aURIescape[] = "escape";
|
|
|
|
char aURIunescape[] = "unescape";
|
2013-11-04 20:11:00 +01:00
|
|
|
|
2015-03-20 13:04:14 +01:00
|
|
|
// status flags
|
2013-11-04 20:11:00 +01:00
|
|
|
#define FLAG_HTTP11 1 << 0
|
|
|
|
#define FLAG_GOT_HEADER 1 << 1
|
2014-01-27 20:34:00 +01:00
|
|
|
#define FLAG_GOT_ALL_DATA 1 << 2
|
2013-11-04 20:11:00 +01:00
|
|
|
#define FLAG_CONTENT_LENGTH 1 << 3
|
|
|
|
#define FLAG_CHUNKED 1 << 4
|
2013-11-15 20:52:54 +01:00
|
|
|
#define FLAG_CONNECTED 1 << 5
|
2013-11-04 20:11:00 +01:00
|
|
|
|
2015-03-20 13:04:14 +01:00
|
|
|
// user flags
|
|
|
|
#define FLAG_KEEPALIVE 1 << 8
|
2015-12-22 19:14:35 +01:00
|
|
|
#define FLAG_MULTIBUFF 1 << 9
|
2015-03-20 13:04:14 +01:00
|
|
|
|
|
|
|
// error flags
|
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-15 20:52:54 +01:00
|
|
|
#define FLAG_TIMEOUT_ERROR 1 << 19
|
2014-01-27 20:34:00 +01:00
|
|
|
#define FLAG_TRANSFER_FAILED 1 << 20
|
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-15 20:52:54 +01:00
|
|
|
dword timestamp;
|
2013-11-04 20:11:00 +01:00
|
|
|
dword status;
|
|
|
|
dword header_length;
|
2015-12-26 02:32:07 +01:00
|
|
|
dword content_ptr;
|
2013-11-04 20:11:00 +01:00
|
|
|
dword content_length;
|
2013-11-05 18:02:59 +01:00
|
|
|
dword content_received;
|
2014-01-27 20:34:00 +01:00
|
|
|
char http_header;
|
2015-07-16 03:44:30 +02:00
|
|
|
};
|
|
|
|
|
2015-07-22 20:32:54 +02:00
|
|
|
|
|
|
|
#endif
|