Port of LwIP performed by Ralf in 2010. Not recommended for use with recent mbed libraries, but good demos of raw LwIP possible
Dependents: LwIP_raw_API_serverExample tiny-dtls
Diff: HTTPServer/HTTPLog.h
- Revision:
- 0:0791c1fece8e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPServer/HTTPLog.h Tue Sep 18 14:41:24 2012 +0000 @@ -0,0 +1,19 @@ +#ifndef HTTPLOG_H +#define HTTPLOG_H + +#include "HTTPServer.h" + +class HTTPLog : public HTTPHandler { + public: + HTTPLog(const char *prefix) : HTTPHandler(prefix) {} + HTTPLog(HTTPServer *server, const char *prefix) : HTTPHandler(prefix) { server->addHandler(this); } + + private: + virtual HTTPHandle action(HTTPConnection *con) const { + struct ip_addr ip = con->pcb()->remote_ip; + 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()); + return HTTP_AddFields; + } +}; + +#endif