MCPcopy Create free account
hub / github.com/Heltec-Aaron-Lee/WiFi_Kit_series / begin

Method begin

libraries/HTTPClient/src/HTTPClient.cpp:114–147  ·  view source on GitHub ↗

* parsing the url for all needed parameters * @param client Client& * @param url String * @param https bool * @return success bool */

Source from the content-addressed store, hash-verified

112 * @return success bool
113 */
114bool HTTPClient::begin(NetworkClient &client, String url) {
115#ifdef HTTPCLIENT_1_1_COMPATIBLE
116 if (_tcpDeprecated) {
117 log_d("mix up of new and deprecated api");
118 _canReuse = false;
119 end();
120 }
121#endif
122
123 _client = &client;
124
125 // check for : (http: or https:)
126 int index = url.indexOf(':');
127 if (index < 0) {
128 log_d("failed to parse protocol");
129 return false;
130 }
131
132 String protocol = url.substring(0, index);
133 if (protocol != "http" && protocol != "https") {
134 log_d("unknown protocol '%s'", protocol.c_str());
135 return false;
136 }
137
138 _port = (protocol == "https" ? 443 : 80);
139 _secure = (protocol == "https");
140
141#ifdef HTTPCLIENT_NOSECURE
142 if (_secure) {
143 return false;
144 }
145#endif // HTTPCLIENT_NOSECURE
146 return beginInternal(url, protocol.c_str());
147}
148
149/**
150 * directly supply all needed parameters

Callers 9

setCookieMethod · 0.45
generateCookieStringMethod · 0.45
updateMethod · 0.45
updateFsMethod · 0.45
updateSpiffsMethod · 0.45
updateFatfsMethod · 0.45
updateLittlefsMethod · 0.45
runUpdateMethod · 0.45
setupMethod · 0.45

Calls 3

indexOfMethod · 0.80
c_strMethod · 0.80
substringMethod · 0.45

Tested by

no test coverage detected