1#ifndef LIPH_NET_HTTP_H_
2#define LIPH_NET_HTTP_H_
19 std::string method()
const {
return method_; }
21 void method(
const std::string& method);
23 std::string url()
const {
return url_; }
25 void url(
const std::string& url) { url_ = url; }
27 std::string host()
const {
return host_; }
29 void host(
const std::string& host) { host_ = host; }
32 bool parse_header(std::string&);
33 bool parse_request_line(
const std::string&);
47 std::map<std::string, std::string> header_;
53 void set_content(
const std::string&,
const std::string&);
54 std::string content()
const;
55 void parse_header(
const std::string&);
56 std::map<std::string, std::string> header_;
62 typedef void (*http_handle)(
const http_request& req, http_response& res);
63 http_server(
int port = 80);
65 void set_handle(
const std::string& url, http_handle
func);
66 void set_static_sever(
const std::string& url,
const std::string& path);
70 static void handle(std::shared_ptr<socket> client);
72 std::map<std::string, http_handle> url_map_;