-
Notifications
You must be signed in to change notification settings - Fork 1
/
http.h
51 lines (35 loc) · 783 Bytes
/
http.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Created by tyy on 2017/1/19.
//
#ifndef MAFIA_HTTP_H
#define MAFIA_HTTP_H
typedef struct httpclient_s {
struct event_base *base;
struct evhttp_uri *uri;
const char *path;
struct evhttp_connection *conn;
char *url;
const char *host;
int port;
char *useragent;
int status;
} httpclient_t;
#define MAX_BULK_SIZE (32 * 1024 * 1024)
typedef struct bulk_s {
char *data;
int len;
int offset;
int count;
char type[32];
char guid[64];
int batch;
int time;
int full;
int last_time;
volatile int lock;
} bulk_t;
extern bulk_t bulk;
httpclient_t *http_init(const char *url);
void http_exit(httpclient_t *client);
int http_post(httpclient_t *client, char *data, int len);
#endif //MAFIA_HTTP_H