| 71 | } |
| 72 | |
| 73 | void http_rpc::handle_conn(socket_stream* stream) |
| 74 | { |
| 75 | // HTTP ��Ӧ������ |
| 76 | http_response res(stream); |
| 77 | // ��Ӧ������Ϊ xml ��ʽ |
| 78 | res.response_header().set_content_type("text/html"); |
| 79 | |
| 80 | // �� HTTP ����ͷ |
| 81 | if (res.read_header() == false) |
| 82 | { |
| 83 | keep_alive_ = false; |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | string buf; |
| 88 | // �� HTTP ���������� |
| 89 | if (res.get_body(buf) == false) |
| 90 | { |
| 91 | keep_alive_ = false; |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | http_client* client = res.get_client(); |
| 96 | |
| 97 | // �жϿͻ����Ƿ�ϣ�����ֳ����� |
| 98 | keep_alive_ = client->keep_alive(); |
| 99 | |
| 100 | // �������ݸ��ͻ��� |
| 101 | |
| 102 | res.response_header() |
| 103 | .set_status(200) |
| 104 | .set_keep_alive(keep_alive_) |
| 105 | .set_content_length(buf_size_); |
| 106 | |
| 107 | res.response(res_buf_, buf_size_); |
| 108 | |
| 109 | // ȡ�ÿͻ��˵����� |
| 110 | const char* action = client->request_param("action"); |
| 111 | if (action && (strcasecmp(action, "stop") == 0 |
| 112 | || strcasecmp(action, "quit") == 0)) |
| 113 | { |
| 114 | proc_quit_ = true; |
| 115 | } |
| 116 | } |
nothing calls this directly
no test coverage detected