A simple web server that can be bound to either the EthernetInterface or the WiflyInterface.
Dependents: Smart-WiFly-WebServer WattEye X10Svr SSDP_Server
Diff: SW_HTTPServer.cpp
- Revision:
- 21:660143f20b04
- Parent:
- 20:786aa5749007
- Child:
- 22:55974de690c1
- Child:
- 24:062431453abb
--- a/SW_HTTPServer.cpp Sat Sep 14 22:41:20 2013 +0000 +++ b/SW_HTTPServer.cpp Thu Sep 26 23:47:50 2013 +0000 @@ -373,30 +373,6 @@ } -bool HTTPServer::GetRemoteAddr(char * str, int strSize) -{ - bool res = false; - char *p; - - if (strSize < 16) { // Can only guard it here w/o modifying Wifly class - *str = '\0'; - return res; - } - res = wifly->sendCommand("show z\r", NULL, str, strSize); - if (res) { - p = strchr(str, '\n'); // truncate after the octets. - if (p) *p = '\0'; - p = strchr(str, ' '); // or a space - if (p) *p = '\0'; - p = strchr(str, '<'); // or a < - if (p) *p = '\0'; - res = true; - } - wifly->exit(); - return res; -} - - void HTTPServer::header(int code, const char * code_text, const char * content_type, const char * optional_text) { char http[100]; @@ -758,3 +734,27 @@ } +#ifdef INCLUDE_GETREMOTE +bool HTTPServer::GetRemoteAddr(char * str, int strSize) +{ + bool res = false; + char *p; + + if (strSize < 16) { // Can only guard it here w/o modifying Wifly class + *str = '\0'; + return res; + } + res = wifly->sendCommand("show z\r", NULL, str, strSize); + if (res) { + p = strchr(str, '\n'); // truncate after the octets. + if (p) *p = '\0'; + p = strchr(str, ' '); // or a space + if (p) *p = '\0'; + p = strchr(str, '<'); // or a < + if (p) *p = '\0'; + res = true; + } + wifly->exit(); + return res; +} +#endif