for Low Memory Platforms.

Dependents:   TinyHTTPServer_WIZ820io

Fork of HTTPD by Suga koubou

Files at this revision

API Documentation at this revision

Comitter:
ban4jp
Date:
Tue Feb 04 03:07:05 2014 +0000
Parent:
1:5f009a651656
Commit message:
Changed server name.; Disabled keep-alive.

Changed in this revision

HTTPD.h Show annotated file Show diff for this revision Revisions of this file
HTTPD_req.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPD_util.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5f009a651656 -r 905fe8dfebd6 HTTPD.h
--- a/HTTPD.h	Sat Feb 01 15:46:26 2014 +0000
+++ b/HTTPD.h	Tue Feb 04 03:07:05 2014 +0000
@@ -20,17 +20,14 @@
 #define HTTPD_H
 
 #include "mbed.h"
-//#include "rtos.h"
-//#include "EthernetInterface.h"
 #include "TCPSocketServer.h"
 #include "CBuffer.h"
 
 //#define DEBUG
 
 #define HTTPD_PORT 80
-//#define HTTPD_MAX_CLIENTS 2
 #define HTTPD_MAX_CLIENTS 1
-#define HTTPD_KEEPALIVE 10
+#define HTTPD_KEEPALIVE 0 // keep-alive off
 #define HTTPD_TIMEOUT 15000
 #define HTTPD_MAX_HANDLES 10
  
@@ -52,6 +49,7 @@
 #define INFO(x, ...)
 #endif
 
+const char* const server_name = "Server: Tiny-HTTPD(mbed)\r\n";
 
 class HTTPD {
 public:
diff -r 5f009a651656 -r 905fe8dfebd6 HTTPD_req.cpp
--- a/HTTPD_req.cpp	Sat Feb 01 15:46:26 2014 +0000
+++ b/HTTPD_req.cpp	Tue Feb 04 03:07:05 2014 +0000
@@ -46,7 +46,7 @@
             fseek(fp, i, SEEK_SET);
         }
 
-        strcpy(buf, "Server: GSwifi httpd\r\n");
+        strcpy(buf, server_name);
         _state[id].client->send_all(buf, strlen(buf));
         if (_state[id].keepalive) {
             strcpy(buf, "Connection: Keep-Alive\r\n");
diff -r 5f009a651656 -r 905fe8dfebd6 HTTPD_util.cpp
--- a/HTTPD_util.cpp	Sat Feb 01 15:46:26 2014 +0000
+++ b/HTTPD_util.cpp	Tue Feb 04 03:07:05 2014 +0000
@@ -63,7 +63,7 @@
 
     strcpy(buf, "HTTP/1.1 200 OK\r\n");
     _state[id].client->send_all(buf, strlen(buf));
-    strcpy(buf, "Server: GSwifi httpd\r\n");
+    strcpy(buf, server_name);
     _state[id].client->send_all(buf, strlen(buf));
     if (_state[id].keepalive) {
         strcpy(buf, "Connection: Keep-Alive\r\n");