MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / runRequest

Method runRequest

test/test_emscripten_async_wget2.cpp:226–253  ·  view source on GitHub ↗

* Effectue la requete */

Source from the content-addressed store, hash-verified

224 * Effectue la requete
225 */
226void http::runRequest(const char* page, int async) {
227 _page = page;
228 _status = ST_PENDING;
229 _async = (AsyncMode)async;
230 _progressValue = 0;
231
232 std::string url = cross_domain;
233 url += _hostname + _page;
234
235 if (_hostname.size() > 0 && _page.size() > 0) {
236
237 printf("URL : %s\n",url.c_str());
238 printf("REQUEST : %s\n", _request == REQUEST_GET ? "GET" : "POST");
239 printf("PARAMS : %s\n",_param.c_str());
240
241 if (_targetFileName.size() == 0 ) {
242 _targetFileName = format("prepare%d",_uid);
243 }
244
245 _handle = emscripten_async_wget2(url.c_str(), _targetFileName.c_str(), _request == REQUEST_GET ? "GET" : "POST", _param.c_str(), this, http::onLoaded, http::onError, http::onProgress);
246
247 } else {
248 _error = format("malformed url : %s\n",url.c_str());
249 _content = "";
250 _status = ST_FAILED;
251 _progressValue = -1;
252 }
253}
254
255/**
256* Post

Callers 1

mainFunction · 0.80

Calls 4

printfFunction · 0.85
formatFunction · 0.70
sizeMethod · 0.65
c_strMethod · 0.45

Tested by

no test coverage detected