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

Method parse

lib_acl_cpp/src/http/http_utils.cpp:90–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool http_url::parse(const char *url) {
91 const char* ptr;
92
93 if (!strncasecmp(url, HTTP_PREFIX, sizeof(HTTP_PREFIX) - 1)) {
94 ptr = url + sizeof(HTTP_PREFIX) - 1;
95 } else if (!strncasecmp(url, HTTPS_PREFIX, sizeof(HTTPS_PREFIX) - 1)) {
96 ptr = url + sizeof(HTTPS_PREFIX) - 1;
97 port_ = 443;
98 ACL_SAFE_STRNCPY(proto_, "https", sizeof(proto_));
99 } else if (*url == '/'){
100 ptr = url;
101 } else {
102 logger_error("invalid url: %s", url);
103 return false;
104 }
105
106 if (*ptr == 0) {
107 logger_error("invalid url: %s", url);
108 return false;
109 }
110
111 if (ptr == url) {
112 // ˵���ǽ������·���� url
113 return parse_url_part(url);
114 } else {
115 // ˵������������·���� url����������ȡ�����ֶΣ�����ȡ��� url
116 ptr = parse_domain(ptr);
117 if (ptr == NULL) {
118 url_path_ = "/";
119 return true;
120 }
121 return parse_url_part(ptr);
122 }
123}
124
125#define SKIP_WHILE(cond, ptr) { while(*ptr && (cond)) ptr++; }
126

Callers 4

http_requestMethod · 0.45
set_charset_convMethod · 0.45
get_pipeMethod · 0.45
readHeaderMethod · 0.45

Calls 1

strncasecmpFunction · 0.85

Tested by

no test coverage detected