HTTPLog.h

11 Dec 2009

Hi Rolf,

 

I noticed there is a nice class hidden in HTTPServer files - HTTPLog. It seems to be designed for logging HTTP activity. I tried using it, and apparently it got behind from the rest of HTTPServer code, so it does not compile with problems in line 13: "struct ip_addr ip = con->pcb()->remote_ip;". I did some code digging, and the simplest fix I came up with was to:

1. Change the offending line to "struct ip_addr ip = con->get_remote_ip();"

2. Add the following function to TCPConnection.h file:

    struct ip_addr get_remote_ip() const {
      return _ipaddr;
    }

 

Is that the way to go? If yes, could you include the proposed changes into SVN?

14 Dec 2009

Hi Ilya,

 

The HTTPLog.h was just an example how to write another Handler for logging. It properly needs some update, but it is mainly to show up how to write your own logging handler. Most people don't want to log to stdout. I've heard from some how logging into files and other on an LCD screen. And even the information you want to log might be different.

But with a working version of this demo everybody can create a his own class.

I will fix with the next version.

 

Thanks

Rolf

14 Dec 2009

Hi Rolf,

 

Thanks for taking care of HTTPLog.h. I hope your fix will include a capability to get IP address of the client connected to the server from the handler. I fixed HTTPLog.h by adding a property read function to TCPConnection.h in my sandbox and can indeed log either to serial or to file.

I have problems on HTTPServer when 2 clients periodically read rpc value from MBED - the response gets lost to both of them way more frequently than if only one client is active. I am logging the server side to help figuring it out.

 

--

Ilya