marcoskirsch / nodemcu-httpserver

A (very) simple web server written in Lua for the ESP8266 firmware NodeMCU.
GNU General Public License v2.0
397 stars 166 forks source link

Fix the problem with the more modern SDK only allowing one outstanding connection:send #43

Closed pjsg closed 8 years ago

pjsg commented 8 years ago

This fixes the problem that I reported in an almost backwards compatible way. The only change is that file serving functions must NOT call coroutine.yield() This is all handled inside the :send method.

This works for me using the current dev build.....

marcoskirsch commented 8 years ago

Did you get a chance to test out the bundled examples?

pjsg commented 8 years ago

Yes -- I checked all the examples. I fixed a bug in node_info: it would try and concat a nil value under some circumstances. Also, for reasons that I don't understand, it would reset my nodemcu until I changed the declaration of the returned variables for node.info() to be local. I suspect that there is some underlying bug in the firmware, but it isn't obvious to me what it is. It is something to do with the concatenation operator and the global variables. The line:

local x = majorVer.."."..minorVer.."."..devVer

causes the trap (if the majorVer etc are globals. Works if they are locals).

dfeinzeig commented 8 years ago

Did you mean to include http/Thumbs.db?

pjsg commented 8 years ago

Argh! Thumbs.db removed as well.

marcoskirsch commented 8 years ago

Thanks!