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

Method write_body

lib_acl_cpp/src/http/http_request.cpp:315–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315bool http_request::write_body(const void* data, size_t len)
316{
317 while (true) {
318 // ���뱣֤�������Ѿ���
319 if (client_ == NULL) {
320 logger_error("connection not opened yet!");
321 return false;
322 }
323
324 if (! client_->write_body(data, len)) {
325 if (!need_retry_) {
326 return false;
327 }
328
329 // ȡ�����Ա�־λ
330 need_retry_ = false;
331
332 // �ȹر�֮ǰ�����ӣ��� write_head() �����´�����
333 close();
334
335 // ������һ��
336 if (! write_head()) {
337 return false;
338 }
339
340 // �ٴ�д������
341 continue;
342 }
343
344 // ˵�������Ѿ�����д�����ˣ�����Ӧ��ȡ�����Ա�־λ
345 need_retry_ = false;
346
347 // ������ݷǿգ���˵���������ݿ�д
348 if (data != NULL && len > 0) {
349 return true;
350 }
351
352 // data == NULL || len == 0 ʱ����ʾ��������
353 // �Ѿ�������ϣ���ʼ�ӷ���˶�ȡ HTTP ��Ӧ����
354 // �� HTTP ��Ӧͷ
355 if (client_->read_head()) {
356 break;
357 }
358
359 return false;
360 }
361
362 // ˵�����������Ѿ�������ϣ����ҳɹ���ȡ�� HTTP ��Ӧͷ��
363 // ������Զ�ȡ HTTP ��Ӧ��������
364
365 // �����ַ���ת����
366 set_charset_conv();
367
368 // ��鷵��ͷ���Ƿ��� Content-Range �ֶ�
369 check_range();
370
371 return true;
372}

Callers 2

send_requestMethod · 0.45
send_fileMethod · 0.45

Calls 2

read_headMethod · 0.80
closeFunction · 0.50

Tested by

no test coverage detected