MCPcopy Create free account
hub / github.com/acl-dev/acl / do_plain

Method do_plain

lib_acl_cpp/samples/http_response/main.cpp:80–102  ·  view source on GitHub ↗

���� text/plain ������

Source from the content-addressed store, hash-verified

78private:
79 // ���� text/plain ������
80 bool do_plain(http_response& res, const char* req_charset, string& err) {
81 string body;
82 if (res.get_body(body, local_charset_) == false) {
83 err += "get_body error";
84 return false;
85 }
86 printf("body:\r\n(%s)\r\n", body.c_str());
87
88 // ������Ӧͷ�ֶ�
89 http_header& header = res.response_header();
90 string ctype("text/plain");
91 if (req_charset) {
92 ctype << "; charset=" << req_charset;
93 header.set_content_type(ctype);
94 } else {
95 header.set_content_type(ctype);
96 }
97
98 printf(">>ctype: %s\r\n", ctype.c_str());
99
100 // ������Ӧ������
101 return response_body(res, body, req_charset);
102 }
103
104 // ���� text/xml ������
105 bool do_xml(http_response& res, const char* req_charset, string& err) {

Callers

nothing calls this directly

Calls 3

set_content_typeMethod · 0.80
get_bodyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected