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

Method send_request

lib_acl_cpp/src/http/http_aclient.cpp:689–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689void 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
725void http_aclient::ws_handshake(const char* key)
726{

Callers

nothing calls this directly

Calls 9

http_hdr_res_freeFunction · 0.85
http_hdr_res_newFunction · 0.85
http_hdr_res_get_asyncFunction · 0.85
get_methodMethod · 0.80
get_astreamMethod · 0.80
build_requestMethod · 0.45
writeMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected