f
Fork of lwip by
precomp/HTTPServer/HTTPLog.h@0:5e1631496985, 2012-05-08 (annotated)
- Committer:
- root@mbed.org
- Date:
- Tue May 08 15:32:10 2012 +0100
- Revision:
- 0:5e1631496985
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
root@mbed.org | 0:5e1631496985 | 1 | #ifndef HTTPLOG_H |
root@mbed.org | 0:5e1631496985 | 2 | #define HTTPLOG_H |
root@mbed.org | 0:5e1631496985 | 3 | |
root@mbed.org | 0:5e1631496985 | 4 | #include "HTTPServer.h" |
root@mbed.org | 0:5e1631496985 | 5 | |
root@mbed.org | 0:5e1631496985 | 6 | class HTTPLog : public HTTPHandler { |
root@mbed.org | 0:5e1631496985 | 7 | public: |
root@mbed.org | 0:5e1631496985 | 8 | HTTPLog(const char *prefix) : HTTPHandler(prefix) {} |
root@mbed.org | 0:5e1631496985 | 9 | HTTPLog(HTTPServer *server, const char *prefix) : HTTPHandler(prefix) { server->addHandler(this); } |
root@mbed.org | 0:5e1631496985 | 10 | |
root@mbed.org | 0:5e1631496985 | 11 | private: |
root@mbed.org | 0:5e1631496985 | 12 | virtual HTTPHandle action(HTTPConnection *con) const { |
root@mbed.org | 0:5e1631496985 | 13 | struct ip_addr ip = con->pcb()->remote_ip; |
root@mbed.org | 0:5e1631496985 | 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()); |
root@mbed.org | 0:5e1631496985 | 15 | return HTTP_AddFields; |
root@mbed.org | 0:5e1631496985 | 16 | } |
root@mbed.org | 0:5e1631496985 | 17 | }; |
root@mbed.org | 0:5e1631496985 | 18 | |
root@mbed.org | 0:5e1631496985 | 19 | #endif |