HTTP Server upon new mbed Ethernet Interface. Based on original code by Henry Leinen.

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of HTTP_server by pablo gindel

Revision:
3:27b3a889b327
Parent:
2:dc9184e97328
Child:
4:2a34139c7246
--- a/HTTPServer.h	Sun Jul 28 07:53:35 2013 +0000
+++ b/HTTPServer.h	Tue Jul 30 04:37:09 2013 +0000
@@ -31,17 +31,16 @@
 #include <string>
 #include <map>
 
-#define BUFFER_SIZE     256
+#define BUFFER_SIZE     256       // all-purpose buffer
 #define TIMEOUT         800
 #define OK              0
 #define ERROR           -1
 #define EMPTY           -2
 #define MIN_LONG        3
-#define MAX_CHUNK_SIZE  512
-#define MIN_CHUNK_SIZE  128
+#define CHUNK_SIZE      256
 
 #define DEBUG 0
-#include "debug.h"
+#include "../debug.h"
 
 enum RequestType {
      HTTP_RT_GET,        /*!< GET request */
@@ -57,9 +56,11 @@
      // Contains the HTTP/1.1 or HTTP/1.0 version requested by client.
      std::string version;
      // Map of headers provided by the client in the form <HeaderName>:<HeaderValue>
-     std::map<std::string, std::string>      headers;
+     std::map<std::string, std::string> headers;
      // Map of arguments that came with the uri string
-     std::map<std::string, std::string> args;
+     std::map<std::string, std::string> uri_args;
+     // length of the body data section
+     int body_length;
 };
 
 struct RequestConfig {
@@ -77,7 +78,7 @@
     char buffer [BUFFER_SIZE];
     int pollConnection ();
     int receiveLine ();
-    int parse ();
+    int parseRequest ();
     int parseHeader ();
     int parseUriArgs (char *uri_buffer);
     void handleRequest ();
@@ -120,4 +121,7 @@
 };
 
 
+void url_decode (char *str);
+
+
 #endif //__HTTPSERVER_H__