3 * Copyright (C) 2008, Eduardo Silva P.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 /* Hard coded restrictions */
24 #define HTTP_DIRECTORY_BACKWARD ".."
27 #define HTTP_METHOD_UNKNOWN (-1)
28 #define HTTP_METHOD_GET (0)
29 #define HTTP_METHOD_POST (1)
30 #define HTTP_METHOD_HEAD (2)
32 #define HTTP_METHOD_GET_STR "GET"
33 #define HTTP_METHOD_POST_STR "POST"
34 #define HTTP_METHOD_HEAD_STR "HEAD"
36 mk_pointer mk_http_method_get_p
;
37 mk_pointer mk_http_method_post_p
;
38 mk_pointer mk_http_method_head_p
;
39 mk_pointer mk_http_method_null_p
;
42 #define METHOD_NOT_ALLOWED (-1)
43 #define METHOD_NOT_FOUND (-2)
44 #define METHOD_EMPTY (-3)
46 #define HTTP_PROTOCOL_UNKNOWN (-1)
47 #define HTTP_PROTOCOL_09 (9)
48 #define HTTP_PROTOCOL_10 (10)
49 #define HTTP_PROTOCOL_11 (11)
51 #define HTTP_PROTOCOL_09_STR "HTTP/0.9"
52 #define HTTP_PROTOCOL_10_STR "HTTP/1.0"
53 #define HTTP_PROTOCOL_11_STR "HTTP/1.1"
55 mk_pointer mk_http_protocol_09_p
;
56 mk_pointer mk_http_protocol_10_p
;
57 mk_pointer mk_http_protocol_11_p
;
58 mk_pointer mk_http_protocol_null_p
;
63 int mk_http_method_check(mk_pointer method
);
64 //char *mk_http_method_check_str(int method);
65 mk_pointer
mk_http_method_check_str(int method
);
66 int mk_http_method_get(char *body
);
68 int mk_http_protocol_check(char *protocol
, int len
);
69 mk_pointer
mk_http_protocol_check_str(int protocol
);
71 int mk_http_init(struct client_request
*cr
, struct request
*sr
);
72 int mk_http_keepalive_check(int socket
, struct client_request
*cr
);
73 int mk_http_directory_redirect_check(struct client_request
*cr
,
75 int mk_http_range_set(struct request
*sr
, long file_size
);
76 int mk_http_range_parse(struct request
*sr
);
78 mk_pointer
*mk_http_status_get(short int code
);
79 void mk_http_status_list_init();
80 int mk_http_pending_request(struct client_request
*cr
);