Changed the directory structure, added a build script
[theodwalha.git] / theodwalha / include / request.hpp
blob617dc3608c011351c9ddafe22a554037c3ebc5aa
1 #pragma once
3 #include <string>
4 #include <vector>
5 #include <map>
7 namespace http_protocol
9 enum type
11 version_1_0,
12 version_1_1
16 namespace http_request_method
18 enum type
20 get,
21 post
25 namespace http_form_content
27 enum type
29 application_x_www_form_urlencoded,
30 multipart_form_data
34 struct quality_entry
36 std::string name;
37 float quality_value;
39 quality_entry();
40 quality_entry(std::string const & name);
41 quality_entry(std::string const & name, float quality_value);
44 typedef std::vector<quality_entry> quality_entries;
46 struct http_request
48 http_protocol::type protocol_version;
49 http_request_method::type method;
50 http_form_content::type content_type;
51 std::size_t header_size;
52 std::size_t content_length;
54 bool
55 has_content_type,
56 has_content_length,
57 keep_alive,
58 gzip;
60 std::string
61 path,
62 user_agent,
63 host,
64 referrer;
66 quality_entries accepted_encodings;
68 std::map<std::string, std::string>
69 cookies,
70 form_fields;
72 http_request();
75 namespace process_header_result
77 enum type
79 no_delimiter,
80 error,
81 success
85 bool decode_path(std::string const & input, std::string & output);
86 process_header_result::type process_header(std::string const & input, http_request & output, std::string & error_message);