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

Method reset

lib_acl_cpp/src/http/http_download.cpp:50–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool http_download::reset(const char* url /* = NULL */,
51 const char* addr /* = NULL */)
52{
53 if (url) {
54 if (url_) {
55 acl_myfree(url_);
56 url_ = NULL;
57 }
58 if (addr) {
59 ACL_SAFE_STRNCPY(addr_, addr, sizeof(addr_));
60 } else if (!http_utils::get_addr(url, addr_, sizeof(addr_))) {
61 logger_error("url(%s) invalid", url);
62 addr_[0] = 0;
63 if (req_) {
64 delete req_;
65 req_ = NULL;
66 }
67 return false;
68 }
69 url_ = acl_mystrdup(url);
70 } else if (url_ == NULL) {
71 return false;
72 } else if (addr) {
73 ACL_SAFE_STRNCPY(addr_, addr, sizeof(addr_));
74 }
75
76 if (req_) {
77 delete req_;
78 }
79 req_ = NEW http_request(addr_); // HTTP �������
80 req_->request_header().set_url(url_)
81 .set_content_type("text/html")
82 .set_host(addr_);
83 return true;
84}
85
86http_header* http_download::request_header() const
87{

Callers

nothing calls this directly

Calls 4

set_content_typeMethod · 0.80
request_headerMethod · 0.80
get_addrFunction · 0.50
http_requestClass · 0.50

Tested by

no test coverage detected