| 290 | } |
| 291 | |
| 292 | bool http_response::response(const void* data, size_t len) |
| 293 | { |
| 294 | if (client_ == NULL) { |
| 295 | logger_error("conn not opened"); |
| 296 | return false; |
| 297 | } |
| 298 | |
| 299 | // ��һ�ε��ñ�����ʱӦ�ȷ��� HTTP ��Ӧͷ |
| 300 | if (!head_sent_) { |
| 301 | if (!client_->write_head(header_)) { |
| 302 | close(); |
| 303 | return false; |
| 304 | } |
| 305 | head_sent_ = true; |
| 306 | } |
| 307 | |
| 308 | if (data == NULL || len == 0) { |
| 309 | head_sent_ = false; |
| 310 | } |
| 311 | |
| 312 | // ���� HTTP ��Ӧ������ |
| 313 | if (!client_->write_body(data, len)) { |
| 314 | close(); |
| 315 | return false; |
| 316 | } |
| 317 | |
| 318 | return true; |
| 319 | } |
| 320 | |
| 321 | } // namespace acl |
no test coverage detected