summaryrefslogtreecommitdiff
path: root/src/Http.h
blob: 69f7a0924c6c162b40b85aba0d7f5755603c0c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Http.h
 *
 *  Created on: 2014. 6. 18.
 *      Author: oskwon
 */

#ifndef HTTP_H_
#define HTTP_H_

#include <map>
#include <string>

#include "Mpeg.h"
//----------------------------------------------------------------------

class HttpHeader
{
public:
	enum {
		UNKNOWN = 0,
		TRANSCODING_LIVE,
		TRANSCODING_FILE,
		M3U
	};

	int type;
	std::string method;
	std::string path;
	std::string version;
	std::map<std::string, std::string> params;

	std::string page;
	std::map<std::string, std::string> page_params;

	std::string authorization;
public:
	HttpHeader() : type(UNKNOWN) {}
	virtual ~HttpHeader() {}

	bool parse_request(std::string header);
	std::string build_response(Mpeg *source);

	static std::string read_request();
};
//----------------------------------------------------------------------

namespace HttpUtil {
	std::string http_error(int errcode, std::string errmsg);
};
//----------------------------------------------------------------------

#endif /* HTTP_H_ */