Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Smart-WiFly-WebServer WattEye X10Svr SSDP_Server
Diff: SW_HTTPServer.cpp
- Revision:
- 43:3fc773c2986e
- Parent:
- 42:0d5b682bb17a
- Child:
- 44:71f09e4255f4
diff -r 0d5b682bb17a -r 3fc773c2986e SW_HTTPServer.cpp
--- a/SW_HTTPServer.cpp Wed Sep 03 10:42:33 2014 +0000
+++ b/SW_HTTPServer.cpp Mon Feb 02 03:01:00 2015 +0000
@@ -12,7 +12,7 @@
//
#include "mbed.h"
-//#define DEBUG "HTTP"
+#define DEBUG "HTTP"
#include <cstdio>
#if (defined(DEBUG) && !defined(TARGET_LPC11U24))
#define DBG(x, ...) std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
@@ -94,7 +94,7 @@
HTTPServer::HTTPServer(
int port,
const char * _webroot,
- int maxheaderParams,
+ int _maxheaderParams,
int _maxqueryParams,
int _maxdynamicpages,
PC * _pc,
@@ -105,7 +105,7 @@
strcpy(webroot, _webroot);
if (strlen(webroot)>1 && webroot[strlen(webroot)-1] == '/') // remove trailing '/'
webroot[strlen(webroot)-1] = '\0';
- maxdynamicpages = _maxdynamicpages;
+ maxheaderParams = _maxheaderParams;
headerParams = (namevalue *)malloc(maxheaderParams * sizeof(namevalue));
maxqueryParams = _maxqueryParams;
@@ -115,7 +115,7 @@
maxPostParams = _maxqueryParams; // Same as Query params, but for post method
postParams = (namevalue *)malloc(maxPostParams * sizeof(namevalue));
postParamCount = 0;
-
+ maxdynamicpages = _maxdynamicpages;
handlers = (handler *)malloc(maxdynamicpages * sizeof(handler));
headerbuffersize = _allocforheader;
headerbuffer = (char *)malloc(headerbuffersize);
@@ -663,6 +663,7 @@
// "Connection: keep-alive" becomes "Connection" "keep-alive"
char *delim = strstr(soRec, ": ");
char *chkSpace = strchr(soRec, ' '); // a field-name has no space ahead of the ":"
+ INFO("hpc:%d,mhp:%d, {%s}", headerParamCount, maxheaderParams, soRec);
if (delim
&& (!chkSpace || (chkSpace && delim < chkSpace))
&& headerParamCount < maxheaderParams) {