My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

HTTPServer/HTTPLog.h

Committer:
screamer
Date:
2012-11-20
Revision:
1:284f2df30cf9
Parent:
0:7a64fbb4069d

File content as of revision 1:284f2df30cf9:

#ifndef HTTPLOG_H
#define HTTPLOG_H

#include "HTTPServer.h"

class HTTPLog : public HTTPHandler {
  public:
    HTTPLog(const char *prefix) : HTTPHandler(prefix) {
    }

  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