| 687 | } |
| 688 | |
| 689 | void http_aclient::send_request(const void* body, size_t len) |
| 690 | { |
| 691 | http_method_t method = header_->get_method(); |
| 692 | if (body && len > 0 && method != HTTP_METHOD_POST |
| 693 | && method != HTTP_METHOD_PUT && method != HTTP_METHOD_PATCH) { |
| 694 | |
| 695 | header_->set_content_length(len); |
| 696 | header_->set_method(HTTP_METHOD_POST); |
| 697 | } |
| 698 | |
| 699 | // ���� HTTP ����ͷ������ |
| 700 | string buf; |
| 701 | header_->build_request(buf); |
| 702 | conn_->write(buf.c_str(), (int) buf.size()); |
| 703 | |
| 704 | if (body && len > 0) { |
| 705 | // ���� HTTP ������ |
| 706 | conn_->write(body, (int) len); |
| 707 | } |
| 708 | |
| 709 | // �� HTTP �����ӱ�����ʱ����Ҫ��ǰһ�δ�������ʱ�����ͷţ��������� |
| 710 | // �ڴ�й¶��ͬʱҪ�� http_res_ �����еij�Ա hdr_res ��NULL�������� |
| 711 | // �����ͷ� http_res_ ʱ���Ա��� hdr_res ���ظ��ͷ� |
| 712 | if (hdr_res_) { |
| 713 | http_hdr_res_free(hdr_res_); |
| 714 | if (http_res_) { |
| 715 | http_res_->hdr_res = NULL; |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | // ��ʼ��ȡ HTTP ��Ӧͷ |
| 720 | hdr_res_ = http_hdr_res_new(); |
| 721 | http_hdr_res_get_async(hdr_res_, conn_->get_astream(), |
| 722 | http_res_hdr_cllback, this, rw_timeout_); |
| 723 | } |
| 724 | |
| 725 | void http_aclient::ws_handshake(const char* key) |
| 726 | { |
nothing calls this directly
no test coverage detected