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

Method read_body

lib_acl_cpp/src/http/http_request.cpp:906–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904}
905
906int http_request::read_body(string& out, bool clean /* = false */,
907 int* real_size /* = NULL */)
908{
909 if (clean) {
910 out.clear();
911 }
912 if (client_ == NULL) {
913 logger_error("connection not opened yet");
914 return -1;
915 }
916
917 int ret;
918
919 if (conv_ == NULL) {
920 return client_->read_body(out, clean, real_size);
921 }
922
923 size_t saved_size = out.length();
924 string buf(4096);
925 ret = client_->read_body(buf, true, real_size);
926 if (ret < 0) {
927 conv_->update_finish(&out);
928 return ret;
929 }
930
931 if (ret == 0) {
932 conv_->update_finish(&out);
933 } else if (ret > 0) {
934 conv_->update(buf.c_str(), ret, &out);
935 }
936
937 size_t curr_size = out.length();
938
939 // �ڽ����ַ���ת��ʱ�����ݳߴ���ܱ仯�����Ը���ǰ��ʵ��
940 // ���ݳߴ�֮�������㱾�ζ��������ݳ���
941 return (int) (curr_size - saved_size);
942}
943
944bool http_request::body_gets(string& out, bool nonl /* = true */,
945 size_t* size /* = NULL */)

Callers 1

get_bodyMethod · 0.45

Calls 5

update_finishMethod · 0.80
clearMethod · 0.45
lengthMethod · 0.45
updateMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected