diff options
-rw-r--r-- | lib/HttpServ.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 275112e..46e2c4d 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: HttpServ.cc,v 1.61 2008-01-28 17:30:46 pixel Exp $ */ +/* $Id: HttpServ.cc,v 1.62 2008-02-15 14:50:32 pixel Exp $ */ #include <vector> @@ -483,7 +483,8 @@ void ProcessRequest::ParseMultipart(Handle * s, int len) { void ProcessRequest::ParseVars(Handle * s, int len) { String t, v; char conv[3], l; - int hconv, nbvars; + int hconv; + bool end_of_string = false; ssize_t pos = 0, next; t = ""; @@ -493,18 +494,14 @@ void ProcessRequest::ParseVars(Handle * s, int len) { } // std::cerr << "Post variables line: '" << t << "'\n"; - - // Les variables sont sous la forme 'var1=val1&var2=val2&val3=var3'. Donc le nombre d'occurences - // du caractère '=' indique le nombre de variables. - - // WRONG! WRONG! - nbvars = t.strchrcnt('='); - - for (int i = 0; i < nbvars; i++) { + while (!end_of_string) { // Les variables sont sous la forme 'var1=val1&var2=val2&val3=var3'. Donc on cherche le caractère // & dans la chaine POST. next = t.strchr('&', pos); - if (next < 0) next = t.strlen(); + if (next < 0) { + next = t.strlen(); + end_of_string = true; + } v = ""; while (pos != next) { switch (t[pos]) { |