870
|
1 #ifndef __HTTP_H
|
|
2 #define __HTTP_H
|
|
3
|
|
4 #define HTTP_FIELD_MAX 20
|
|
5
|
|
6 typedef struct {
|
|
7 char *protocol;
|
|
8 char *method;
|
|
9 char *uri;
|
|
10 int status_code;
|
|
11 char *reason_phrase;
|
|
12 int http_minor_version;
|
|
13 char *fields[HTTP_FIELD_MAX];
|
|
14 int field_nb;
|
|
15 char *field_search;
|
|
16 int search_pos;
|
|
17 char *body;
|
|
18 int body_size;
|
|
19 } HTTP_header_t;
|
|
20
|
|
21 HTTP_header_t* http_new_header();
|
|
22 void http_free( HTTP_header_t *http_hdr );
|
|
23 HTTP_header_t* http_new_response( char *data, int length );
|
|
24 char* http_get_request( HTTP_header_t *http_hdr );
|
|
25 char* http_get_field( HTTP_header_t *http_hdr, const char *field_name );
|
|
26 char* http_get_next_field( HTTP_header_t *http_hdr );
|
|
27 void http_set_field( HTTP_header_t *http_hdr, const char *field );
|
|
28 void http_set_method( HTTP_header_t *http_hdr, const char *method );
|
|
29 void http_set_uri( HTTP_header_t *http_hdr, const char *uri );
|
|
30
|
|
31 void http_debug_hdr( HTTP_header_t *http_hdr );
|
|
32
|
|
33 #endif // __HTTP_H
|