Skip to content
Browse files

Last POST param is missed

  • Loading branch information...
1 parent 5cf947d commit 6bdde566d85762f77de2c6e24706a720b4c2d3c6 @Raidok Raidok committed Feb 10, 2012
Showing with 14 additions and 3 deletions.
  1. +14 −3 WebServer.h
View
17 WebServer.h
@@ -810,6 +810,8 @@ bool WebServer::readPOSTparam(char *name, int nameLen,
{
// assume name is at current place in stream
int ch;
+ // to not to miss the last parameter
+ bool foundSomething = false;
// clear out name and value so they'll be NUL terminated
memset(name, 0, nameLen);
@@ -821,6 +823,7 @@ bool WebServer::readPOSTparam(char *name, int nameLen,
while ((ch = read()) != -1)
{
+ foundSomething = true;
if (ch == '+')
{
ch = ' ';
@@ -864,9 +867,17 @@ bool WebServer::readPOSTparam(char *name, int nameLen,
}
}
- // if we get here, we hit the end-of-file, so POST is over and there
- // are no more parameters
- return false;
+ if (foundSomething)
+ {
+ // if we get here, we have one last parameter to serve
+ return true;
+ }
+ else
+ {
+ // if we get here, we hit the end-of-file, so POST is over and there
+ // are no more parameters
+ return false;
+ }
}
/* Retrieve a parameter that was encoded as part of the URL, stored in

0 comments on commit 6bdde56

Please sign in to comment.
Something went wrong with that request. Please try again.