You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears to me as if we didn't support executing multiple http.get (or other HTTP functions) with individual URLs and callbacks. The below code makes two consecutive http.get calls. Each uses a separate URL and a specific callback function.
functionwp(code, data)
if (code<0) thenprint("HTTP request to wp.me failed")
elseprint("wp.me responded with HTTP status " ..code)
endendfunctionnodemcu(code, data)
if (code<0) thenprint("HTTP request to nodemcu.com failed")
elseprint("nodemcu.com responded with HTTP status " ..code)
endendfunctionrun()
http.get("http://wp.me/pzoQb-sk", nil, wp) -- returns HTTP 301http.get("http://nodemcu.com/favicon.png", nil, nodemcu) -- returns HTTP 200end
What I would expect if run is invoked manually is "wp.me responded with HTTP status 301" and "nodemcu.com responded with HTTP status 200" in arbitrary order. What I get instead is a total mix-up:
=run()
nodemcu.com responded with HTTP status 301
=run()
nodemcu.com responded with HTTP status 301
=run()
nodemcu.com responded with HTTP status 200
=run()
nodemcu.com responded with HTTP status 200
=run()
nodemcu.com responded with HTTP status 301
If run is invoked automatically in a loop all requests fail:
fori=1,10dorun() end
HTTP request to wp.me failed
HTTP request to nodemcu.com failed
HTTP request to wp.me failed
HTTP request to nodemcu.com failed
HTTP request to wp.me failed
...
I hope this isn't an embarrassing case where I make a fool of myself because I miss something really obvious. Are we simply missing a few notes in the docs saying that you can have at most one such HTTP operation running at any given time?
The text was updated successfully, but these errors were encountered:
Note that it is not possible to execute concurrent HTTP requests using this module. Starting a new request before the previous has completed will result in undefined behavior.
That's in line with the code, since the module can cope with only one single callback at a time.
http://stackoverflow.com/q/37218528/131929 confused me and I ran a small test myself.
It appears to me as if we didn't support executing multiple
http.get
(or other HTTP functions) with individual URLs and callbacks. The below code makes two consecutivehttp.get
calls. Each uses a separate URL and a specific callback function.What I would expect if
run
is invoked manually is "wp.me responded with HTTP status 301" and "nodemcu.com responded with HTTP status 200" in arbitrary order. What I get instead is a total mix-up:This seems related to #1258.
If
run
is invoked automatically in a loop all requests fail:I hope this isn't an embarrassing case where I make a fool of myself because I miss something really obvious. Are we simply missing a few notes in the docs saying that you can have at most one such HTTP operation running at any given time?
The text was updated successfully, but these errors were encountered: