forked from pedrofranceschi/twitterc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_connection.h
43 lines (35 loc) · 1.08 KB
/
http_connection.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
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include <string.h>
#include <stdlib.h>
#define MAX_BUFFER 65536
typedef enum {
HTTPParameterTypeParameter = 1,
HTTPParameterTypeHeader = 2,
HTTPParameterTypeAuthorizationHeader = 3,
HTTPParameterTypeIgnore = 4
} HTTPParameterType;
typedef struct {
char *key;
char *value;
struct HTTPParameter *next_parameter, *previous_parameter;
HTTPParameterType type;
} HTTPParameter;
typedef enum {
HTTPConnectionMethodGET,
HTTPConnectionMethodPOST,
} HTTPConnectionMethod;
typedef struct {
char *response_buffer;
int response_buffer_length;
char *url;
HTTPParameter *first_parameter;
HTTPConnectionMethod connection_method;
} HTTPConnection;
void HTTPConnection_initialize(HTTPConnection *http_connection);
void HTTPConnection_free(HTTPConnection *http_connection);
void HTTPParameter_initialize(HTTPParameter *http_parameter);
void HTTPParameter_free(HTTPParameter *http_parameter, int free_related_params);
int HTTPConnection_perform_request(HTTPConnection *http_connection);
char *_html_escape_string(char *string);