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

Method read_response_body

lib_acl_cpp/src/http/http_client.cpp:866–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864}
865
866int http_client::read_response_body(char* buf, size_t size)
867{
868 if (hdr_res_ == NULL) {
869 logger_error("response header not get yet");
870 disconnected_ = true;
871 return -1;
872 }
873
874 if (stream_ == NULL) {
875 logger_error("not connected yet");
876 disconnected_ = true;
877 return -1;
878 }
879 ACL_VSTREAM* vstream = stream_->get_vstream();
880 if (vstream == NULL) {
881 logger_error("connect stream null");
882 disconnected_ = true;
883 return -1;
884 }
885
886 if (res_ == NULL) {
887 res_ = http_res_new(hdr_res_);
888 }
889
890 // ������̫����û���κ�����
891 if (size >= 1024000) {
892 size = 1024000;
893 }
894 http_off_t ret = http_res_body_get_sync(res_, vstream, buf, (int) size);
895
896 if (ret <= 0) {
897 // ����ڶ���Ӧͷʱ������ unzip_begin������뱣֤��������
898 // ���ٵ��� unzip_finish���������Ϊ zlib ��������ƶ�����
899 // �ڴ�й¶
900 if (zstream_ != NULL) {
901 string dummy(64);
902 zstream_->unzip_finish(&dummy);
903 }
904 body_finish_ = true;
905 if (ret < 0) {
906 disconnected_ = true;
907 }
908 }
909
910 return (int) ret;
911}
912
913int http_client::read_request_body(char* buf, size_t size)
914{

Callers

nothing calls this directly

Calls 8

http_res_newFunction · 0.85
http_res_body_get_syncFunction · 0.85
unzip_finishMethod · 0.80
unzip_updateMethod · 0.80
get_vstreamMethod · 0.45
clearMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected