ovidiucp / TinyWebServer

Small web server for Arduino, fits in 10KB ROM, less than 512 bytes RAM
http://www.webweavertech.com/ovidiu/weblog/archives/000484.html
GNU Lesser General Public License v2.1
245 stars 65 forks source link

Remove lock functions #15

Closed bigjohnson closed 9 years ago

bigjohnson commented 12 years ago

Hello, I've used your library and is very good, but I think there are two locks in some client data input that can hang the webserver. I suggest the insertion of two timeout check that can unlock the functions when client don't send expected data. I hope the code could be useful. Thanks

Alberto

Here the diff

22a23

define READ_TIMEOUT 100

124a126 uint32_t start_time = millis(); 128a131,133 if (millis() - start_time > READ_TIMEOUT) { return false; } 131a137 start_time = millis(); 522a529 uint32_t start_time = millis(); 523a531,533 if (millis() - start_time > READ_TIMEOUT) { return i < size - 1; } 530a541 start_time = millis();

ovidiucp commented 12 years ago

Thanks for the fix! Would you mind posting a unified diff (diff -u), or even better, sending a pull request?

bigjohnson commented 12 years ago

Here the diff -u Thanks

Alberto

diff -u ovidiucp-TinyWebServer-e46b2fd/TinyWebServer.cpp mio/TinyWebServer.cpp

--- ovidiucp-TinyWebServer-e46b2fd/TinyWebServer.cpp 2012-04-25 11:00:46.000000000 +0200 +++ mio/TinyWebServer.cpp 2012-09-03 11:16:01.000000000 +0200 @@ -20,6 +20,7 @@ // when the debugging is enabled and debugging lines are preceded by 'TWS:'

define DEBUG 0

+#define READ_TIMEOUT 10

include "Arduino.h"

@@ -122,13 +123,18 @@ char ch; int pos; const char* header;

bigjohnson commented 9 years ago

Closed!

ovidiucp commented 9 years ago

Awesome, thanks!

On Wed, Mar 25, 2015 at 9:14 AM, Aberto Panu notifications@github.com wrote:

Closed!

— Reply to this email directly or view it on GitHub https://github.com/ovidiucp/TinyWebServer/issues/15#issuecomment-86100721 .

This confidential email is read by the NSA (at the least).