902
|
1 /*
|
|
2 * HTTP Helper
|
|
3 * by Bertrand Baudet <bertrand_baudet@yahoo.com>
|
|
4 * (C) 2001, MPlayer team.
|
|
5 */
|
|
6
|
870
|
7 #ifndef __HTTP_H
|
|
8 #define __HTTP_H
|
|
9
|
|
10 #define HTTP_FIELD_MAX 20
|
|
11
|
|
12 typedef struct {
|
|
13 char *protocol;
|
|
14 char *method;
|
|
15 char *uri;
|
|
16 int status_code;
|
|
17 char *reason_phrase;
|
|
18 int http_minor_version;
|
|
19 char *fields[HTTP_FIELD_MAX];
|
|
20 int field_nb;
|
|
21 char *field_search;
|
|
22 int search_pos;
|
|
23 char *body;
|
|
24 int body_size;
|
902
|
25 char *buffer;
|
|
26 int buffer_size;
|
|
27 int is_parsed;
|
870
|
28 } HTTP_header_t;
|
|
29
|
|
30 HTTP_header_t* http_new_header();
|
|
31 void http_free( HTTP_header_t *http_hdr );
|
902
|
32 int http_response_append( HTTP_header_t *http_hdr, char *data, int length );
|
|
33 int http_response_parse( HTTP_header_t *http_hdr );
|
|
34 int http_is_header_entired( HTTP_header_t *http_hdr );
|
|
35 char* http_build_request( HTTP_header_t *http_hdr );
|
870
|
36 char* http_get_field( HTTP_header_t *http_hdr, const char *field_name );
|
|
37 char* http_get_next_field( HTTP_header_t *http_hdr );
|
|
38 void http_set_field( HTTP_header_t *http_hdr, const char *field );
|
|
39 void http_set_method( HTTP_header_t *http_hdr, const char *method );
|
|
40 void http_set_uri( HTTP_header_t *http_hdr, const char *uri );
|
|
41
|
|
42 void http_debug_hdr( HTTP_header_t *http_hdr );
|
|
43
|
|
44 #endif // __HTTP_H
|