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

Method body_gets

lib_acl_cpp/src/http/http_client.cpp:1138–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1136}
1137
1138bool http_client::body_gets(string& out, bool nonl /* = true */,
1139 size_t* size /* = NULL */)
1140{
1141 if (buf_ == NULL) {
1142 buf_ = NEW string(4096);
1143 }
1144
1145 size_t len, size_saved = out.length();
1146
1147 // �����ж��Ƿ��Ѿ����� HTTP ������
1148 if (body_finish_) {
1149 if (buf_->empty()) {
1150 if (size) {
1151 *size = 0;
1152 }
1153 return false;
1154 }
1155
1156 // �������������ݷǿ�ʱ���ȳ��Դ��л�ȡһ������
1157 if (buf_->scan_line(out, nonl, &len)) {
1158 if (size) {
1159 *size = out.length() - size_saved;
1160 }
1161 return true;
1162 }
1163
1164 // ������ܶ��������������� HTTP ����������������򽫶�
1165 // �������ڵ����ݶ�������Ŀ�껺����
1166 out.append(buf_);
1167 buf_->clear();
1168
1169 if (size) {
1170 *size = out.length() - size_saved;
1171 }
1172
1173 return true;
1174 }
1175
1176 // ������ HTTP �����壬�����Դ��ж�ȡһ������
1177
1178 len = 0;
1179
1180 while (true) {
1181 if (!buf_->empty()) {
1182 if (buf_->scan_line(out, nonl, &len)) {
1183 if (size) {
1184 *size = out.length() - size_saved;
1185 }
1186 return true;
1187 }
1188
1189 // Ϊ�˼����´�ѭ��ʱ���� scan_line ���ַ������Ҵ�����
1190 // �����������е������ȿ�����Ŀ�껺������
1191
1192 len += buf_->length();
1193 out.append(buf_);
1194 buf_->clear();
1195 }

Callers 1

runMethod · 0.45

Calls 6

scan_lineMethod · 0.80
stringClass · 0.50
lengthMethod · 0.45
emptyMethod · 0.45
appendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected