]> git.tdb.fi Git - libs/net.git/blob - source/message.h
Initial revision
[libs/net.git] / source / message.h
1 /* $Id$
2
3 This file is part of libmsphttp
4 Copyright © 2008  Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_HTTP_MESSAGE_H_
9 #define MSP_HTTP_MESSAGE_H_
10
11 #include <string>
12 #include "misc.h"
13
14 namespace Msp {
15 namespace Http {
16
17 class Message
18 {
19 public:
20         virtual ~Message() { }
21
22         void set_header(const std::string &, const std::string &);
23         const std::string &get_header(const std::string &) const;
24         const std::string &get_data() const { return data; }
25         bool get_complete() const { return complete; }
26         void add_data(const std::string &);
27         unsigned parse_data(const std::string &);
28         virtual std::string str() const =0;
29 protected:
30         Version http_version;
31         HeaderMap headers;
32         std::string data;
33         unsigned chunk_length;
34         bool complete;
35
36         Message();
37         std::string str_common() const;
38 };
39
40 } // namespace Http
41 } // namespace Msp
42
43 #endif