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

Method handle_conn

lib_acl_cpp/samples/master/master_http_rpc/http_rpc.cpp:56–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void http_rpc::handle_conn(acl::socket_stream* stream)
57{
58 // HTTP ��Ӧ������
59 acl::http_response res(stream);
60 // ��Ӧ������Ϊ xml ��ʽ
61 res.response_header().set_content_type("text/html");
62
63 // �� HTTP ����ͷ
64 if (res.read_header() == false)
65 {
66 keep_alive_ = false;
67 return;
68 }
69
70 acl::string buf;
71 // �� HTTP ����������
72 if (res.get_body(buf) == false)
73 {
74 keep_alive_ = false;
75 return;
76 }
77
78 acl::http_client* client = res.get_client();
79
80 // �жϿͻ����Ƿ�ϣ�����ֳ�����
81 keep_alive_ = client->keep_alive();
82
83 // �������ݸ��ͻ���
84
85 res.response_header()
86 .set_status(200)
87 .set_keep_alive(keep_alive_)
88 .set_content_length(buf_size_);;
89 res.response(res_buf_, buf_size_);
90}
91
92void http_rpc::rpc_onover()
93{

Callers

nothing calls this directly

Calls 8

set_content_typeMethod · 0.80
set_keep_aliveMethod · 0.80
responseMethod · 0.80
read_headerMethod · 0.45
get_bodyMethod · 0.45
get_clientMethod · 0.45
keep_aliveMethod · 0.45
set_statusMethod · 0.45

Tested by

no test coverage detected