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

Method on_body

lib_acl_cpp/samples/HttpClient/HttpDownload.cpp:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void CHttpDownload::on_body(const char* data, size_t dlen)
68{
69 if (data == NULL && dlen == 0)
70 {
71#ifdef WIN32
72 printf("\n>> http reply body over, total: %I64d, %I64d\n",
73 content_length_, read_length_);
74#else
75 printf("\n>> http reply body over, total: %lld, %lld\n",
76 content_length_, read_length_);
77#endif
78 // ��������Ϊ��������Ƕ�̬����ģ�������Ҫ�ڴ˴��ͷ�
79 time_t end = time(NULL);
80 printf(">>spent %d seconds\n", (int)(end - begin_));
81 return;
82 }
83 read_length_ += dlen;
84 http_off_t n = (read_length_ * 100) / content_length_;
85#ifdef WIN32
86 printf("%I64d%%\r", n);
87#else
88 printf("%lld%%\r", n);
89#endif
90
91 if (out_.opened())
92 out_.write(data, dlen);
93}
94
95void CHttpDownload::on_error(acl::http_status_t errnum)
96{

Callers

nothing calls this directly

Calls 2

openedMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected