Example of HTTPServer with additional features: * SNTPClient, DST rules * Link status indication * Local or SDCard-based WebServer * RPC-able class * Static and Dynamic HTML page

Dependencies:   mbed

Committer:
iva2k
Date:
Tue Jan 12 07:41:55 2010 +0000
Revision:
2:360fda42fefd
Parent:
0:886e4b3119ad

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iva2k 0:886e4b3119ad 1 #ifndef HTTPLOG_H
iva2k 0:886e4b3119ad 2 #define HTTPLOG_H
iva2k 0:886e4b3119ad 3
iva2k 0:886e4b3119ad 4 #include "HTTPServer.h"
iva2k 0:886e4b3119ad 5
iva2k 0:886e4b3119ad 6 class HTTPLog : public HTTPHandler {
iva2k 0:886e4b3119ad 7 public:
iva2k 0:886e4b3119ad 8 HTTPLog(const char *prefix) : HTTPHandler(prefix) {}
iva2k 0:886e4b3119ad 9 HTTPLog(HTTPServer *server, const char *prefix) : HTTPHandler(prefix) { server->addHandler(this); }
iva2k 0:886e4b3119ad 10
iva2k 0:886e4b3119ad 11 private:
iva2k 0:886e4b3119ad 12 virtual HTTPHandle action(HTTPConnection *con) const {
iva2k 0:886e4b3119ad 13 struct ip_addr ip = con->pcb()->remote_ip;
iva2k 0:886e4b3119ad 14 printf("%hhu.%hhu.%hhu.%hhu %s %s", (ip.addr)&0xFF, (ip.addr>>8)&0xFF, (ip.addr>>16)&0xFF, (ip.addr>>24)&0xFF, (con->getType() == POST? "POST" : "GET"), con->getURL());
iva2k 0:886e4b3119ad 15 return HTTP_AddFields;
iva2k 0:886e4b3119ad 16 }
iva2k 0:886e4b3119ad 17 };
iva2k 0:886e4b3119ad 18
iva2k 0:886e4b3119ad 19 #endif