a

Fork of HTTPServer by Donatien Garnier

Files at this revision

API Documentation at this revision

Comitter:
anze777
Date:
Sun Nov 27 14:43:00 2016 +0000
Parent:
6:d753966e4d97
Commit message:
a

Changed in this revision

LPC2368/HTTPServer.ar Show diff for this revision Revisions of this file
LPC2368/dbg/dbg.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestDispatcher.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPRequestHandler.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/HTTPServer.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/impl/FSHandler.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/impl/RPCHandler.h Show diff for this revision Revisions of this file
LPC2368/services/http/server/impl/SimpleHandler.h Show diff for this revision Revisions of this file
LPC2368/services/http/util/base64.h Show diff for this revision Revisions of this file
LPC2368/services/http/util/url.h Show diff for this revision Revisions of this file
Binary file LPC2368/HTTPServer.ar has changed
--- a/LPC2368/dbg/dbg.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-/** \file
-Debugging helpers header file
-*/
-
-//#ifdef DBG_H
-//#define DBG_H
-
-#ifdef __LWIP_DEBUG
-#define __DEBUG
-#endif
-
-/*!
-  \def __DEBUG
-  To define to enable debugging in one file
-*/
-
-#ifdef __DEBUG
-
-#ifndef __DEBUGSTREAM
-#define __DEBUGSTREAM
-
-
-class DebugStream
-{
-public:
-static void debug(const char* format, ...);
-static void release();
-static void breakPoint(const char* file, int line);
-private:
-
-};
-
-#undef DBG
-#undef DBG_END
-#undef BREAK
-
-///Debug output (if enabled), same syntax as printf, with heading info
-#define DBG(...) do{ DebugStream::debug("[%s:%s@%d] ", __FILE__, __FUNCTION__, __LINE__); DebugStream::debug(__VA_ARGS__); } while(0);
-
-///Debug output (if enabled), same syntax as printf, no heading info
-#define DBGL(...) do{ DebugStream::debug(__VA_ARGS__); } while(0);
-#define DBG_END DebugStream::release
-
-///Break point usin serial debug interface (if debug enbaled)
-#define BREAK() DebugStream::breakPoint(__FILE__, __LINE__)
-#endif
-
-#else
-#undef DBG
-#undef DBG_END
-#undef BREAK
-#define DBG(...)
-#define DBG_END()
-#define BREAK()
-#endif
-
-#ifdef __LWIP_DEBUG
-#ifndef __SNPRINTF
-#define __SNPRINTF
-#include "mbed.h"
-
-//int snprintf(char *str, int size, const char *format, ...);
-#endif
-#endif
-
-#ifdef __LWIP_DEBUG
-#undef __DEBUG
-#endif
-
-//#endif
-
--- a/LPC2368/services/http/server/HTTPRequestDispatcher.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef HTTP_REQUEST_DISPATCHER_H
-#define HTTP_REQUEST_DISPATCHER_H
-
-class HTTPServer;
-
-#include "api/TCPSocket.h"
-#include "HTTPServer.h"
-#include "core/netservice.h"
-
-#include "mbed.h"
-
-#define HTTP_REQUEST_TIMEOUT 5000
-
-#include <string>
-using std::string;
-
-class HTTPRequestDispatcher : public NetService
-{
-public:
-  HTTPRequestDispatcher(HTTPServer* pSvr, TCPSocket* pTCPSocket);
-  virtual ~HTTPRequestDispatcher();
-  
-private:
-
-  enum HTTP_METH
-  {
-    HTTP_GET,
-    HTTP_POST,
-    HTTP_HEAD
-  };
-  
-  void dispatchRequest();
-  
-  virtual void close(); //Close TCPSocket and destroy data
-  
-  void onTCPSocketEvent(TCPSocketEvent e);
-  
-  void onTimeout(); //Connection has timed out
-
-  bool getRequest(string* path, string* meth);
-  
-  HTTPServer* m_pSvr;
-  TCPSocket* m_pTCPSocket;
-  
-  Timeout m_watchdog;
-  bool m_closed;
-};
-
-#endif
--- a/LPC2368/services/http/server/HTTPRequestHandler.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-/**
-HTTP Request Handler header file.
-*/
-
-#ifndef HTTP_REQUEST_HANDLER_H
-#define HTTP_REQUEST_HANDLER_H
-
-#include "api/TCPSocket.h"
-//#include "HTTPServer.h"
-
-#include "mbed.h"
-#include "core/netservice.h"
-
-#include <string>
-using std::string;
-
-#include <map>
-using std::map;
-
-///HTTP Server's generic request handler
-class HTTPRequestHandler : public NetService
-{
-public:
-  ///Instantiated by the HTTP Server
-  HTTPRequestHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
-  virtual ~HTTPRequestHandler();
-
-//protected:
-  virtual void doGet() = 0;
-  virtual void doPost() = 0;
-  virtual void doHead() = 0;
-  
-  virtual void onReadable() = 0; //Data has been read
-  virtual void onWriteable() = 0; //Data has been written & buf is free
-  virtual void onTimeout(); //Connection has timed out
-  virtual void onClose() = 0; //Connection is closing
-  
-  virtual void close(); //Close socket and destroy data
-
-protected:  
-  map<string, string>& reqHeaders() /*const*/;
-  string& path() /*const*/;
-  int dataLen() const;
-  int readData(char* buf, int len);
-  string& rootPath() /*const*/;
-  
-  void setErrCode(int errc);
-  void setContentLen(int len);
-  
-  map<string, string>& respHeaders();
-  int writeData(const char* buf, int len);
-  
-  void setTimeout(int ms);
-  void resetTimeout();
-
-private:
-  void readHeaders(); //Called at instanciation
-  void writeHeaders(); //Called at the first writeData call
-  void onTCPSocketEvent(TCPSocketEvent e);
-   
-  TCPSocket* m_pTCPSocket;
-  map<string, string> m_reqHeaders;
-  map<string, string> m_respHeaders;
-  string m_rootPath;
-  string m_path;
-  int m_errc; //Response code
-  
-  Timeout m_watchdog;
-  int m_timeout;
-  
-  bool m_closed;
-  bool m_headersSent;
-  
-  int readLine(char* str, int maxLen);
-
-};
-
-#endif
--- a/LPC2368/services/http/server/HTTPServer.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-/** \file
-HTTP Server header file
-*/
-
-#ifndef HTTP_SERVER_H
-#define HTTP_SERVER_H
-
-class HTTPRequestHandler;
-class HTTPRequestDispatcher;
-
-#include "core/net.h"
-#include "HTTPRequestHandler.h"
-#include "HTTPRequestDispatcher.h"
-
-#include <string>
-using std::string;
-
-#include <map>
-using std::map;
-
-///A simple HTTP server implementation
-/**
-The HTTPServer is composed of:
-- The actual server (HTTPServer)
-- A request dispatcher, instanciated on each request (HTTPRequestDispatcher)
-- Request handlers instanciated by the dispatcher(deriving from HTTPRequestHandler) 
-*/
-class HTTPServer
-{
-public:
-  ///Instantiates the HTTP Server
-  HTTPServer();
-  ~HTTPServer();
-  
-  struct handlersComp //Used to order handlers in the right way
-  {
-    bool operator() (const string& handler1, const string& handler2) const
-    {
-      //The first handler is longer than the second one
-      if (handler1.length() > handler2.length())
-        return true; //Returns true if handler1 is to appear before handler2
-      else if (handler1.length() < handler2.length())
-        return false;
-      else //To avoid the == case, sort now by address
-        return ((&handler1)>(&handler2));
-    }
-  };
-
-  ///Adds a handler
-  /**
-  Appends a handler to the handlers list
-  @param T : class which will be instanciated to serve these requests
-  @param path : requests starting with this path will be served using this handler
-  */
-  template<typename T>
-  void addHandler(const char* path) //Template decl in header
-  { m_lpHandlers[path] = &T::inst; }
-  
-  ///Starts listening
-  /**
-  Binds server to a specific port and starts listening
-  @param port : port on which to listen for incoming connections
-  */
-  void bind(int port = 80);
-  
-private:
-  friend class HTTPRequestDispatcher;
-
-  void onTCPSocketEvent(TCPSocketEvent e);
-  
-  TCPSocket* m_pTCPSocket;
-  map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*), handlersComp > m_lpHandlers;
-
-};
-
-//Including handlers here for more convenience
-#include "impl/RPCHandler.h"
-#include "impl/FSHandler.h"
-#include "impl/SimpleHandler.h"
-
-#endif
--- a/LPC2368/services/http/server/impl/FSHandler.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef FS_HANDLER_H
-#define FS_HANDLER_H
-
-#include "../HTTPRequestHandler.h"
-#include "mbed.h"
-
-#include <map>
-using std::map;
-
-#include <string>
-using std::string;
-
-class FSHandler : public HTTPRequestHandler
-{
-public:
-  FSHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
-  virtual ~FSHandler();
-  
-  static void mount(const string& fsPath, const string& rootPath);
-
-//protected:
-  static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new FSHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
-
-  virtual void doGet();
-  virtual void doPost();
-  virtual void doHead();
-  
-  virtual void onReadable(); //Data has been read
-  virtual void onWriteable(); //Data has been written & buf is free
-  virtual void onClose(); //Connection is closing
-  
-private:
-  FILE* m_fp;
-  bool m_err404;
-  static map<string,string> m_lFsPath;
-};
-
-#endif
--- a/LPC2368/services/http/server/impl/RPCHandler.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef RPC_HANDLER_H
-#define RPC_HANDLER_H
-
-#include "../HTTPRequestHandler.h"
-
-class RPCHandler : public HTTPRequestHandler
-{
-public:
-  RPCHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
-  virtual ~RPCHandler();
-
-//protected:
-  static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new RPCHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
-
-  virtual void doGet();
-  virtual void doPost();
-  virtual void doHead();
-  
-  virtual void onReadable(); //Data has been read
-  virtual void onWriteable(); //Data has been written & buf is free
-  virtual void onClose(); //Connection is closing
-
-protected:
-  void cleanReq(char* data);
-};
-
-#endif
--- a/LPC2368/services/http/server/impl/SimpleHandler.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef SIMPLE_HANDLER_H
-#define SIMPLE_HANDLER_H
-
-#include "../HTTPRequestHandler.h"
-
-class SimpleHandler : public HTTPRequestHandler
-{
-public:
-  SimpleHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
-  virtual ~SimpleHandler();
-
-//protected:
-  static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SimpleHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
-
-  virtual void doGet();
-  virtual void doPost();
-  virtual void doHead();
-  
-  virtual void onReadable(); //Data has been read
-  virtual void onWriteable(); //Data has been written & buf is free
-  virtual void onClose(); //Connection is closing
-};
-
-#endif
--- a/LPC2368/services/http/util/base64.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef BASE64_H
-#define BASE64_H
-
-#include <string>
-using std::string;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//Originaly from Rolf's iputil.h
-
-unsigned int base64enc_len(const char *str);
-
-void base64enc(const char *input, unsigned int length, char *output);
-
-#ifdef __cplusplus
-}
-#endif
-
-class Base64
-{
-public:
-  static string encode(const string& str)
-  {
-    char* out = new char[ base64enc_len(str.c_str()) ];
-    base64enc(str.c_str(), str.length(), out);
-    string res(out);
-    delete[] out;
-    return res;
-  }
-};
-
-#endif /* LWIP_UTILS_H */
--- a/LPC2368/services/http/util/url.h	Thu Aug 05 15:12:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-
-/*
-Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
- 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
- 
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
- 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef URL_H
-#define URL_H
-
-#include "core/ipaddr.h"
-
-#include <string>
-using std::string;
-
-#include "mbed.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char *url_encode(char *str);
-char *url_decode(char *str);
-
-#ifdef __cplusplus
-}
-#endif
-
-class Url
-{
-public:
-  static string encode(const string& url)
-  {
-    char* c_res = url_encode( (char*) url.c_str() );
-    string res(c_res);
-    free(c_res); //Alloc'ed in url_encode()
-    return res;
-  }
-  
-  static string decode(const string& url)
-  {
-    char* c_res = url_decode( (char*) url.c_str() );
-    string res(c_res);
-    free(c_res); //Alloc'ed in url_decode()
-    return res;
-  }
-  
-  Url();
-
-  string getProtocol();
-  string getHost();
-  bool getHostIp(IpAddr* ip); //If host is in IP form, return true & proper object by ptr
-  uint16_t getPort();
-  string getPath();
-  
-  void setProtocol(string protocol);
-  void setHost(string host);
-  void setPort(uint16_t port);
-  void setPath(string path);
-  
-  void fromString(string str);
-  string toString();
-
-private:
-  string m_protocol;
-  string m_host;
-  uint16_t m_port;
-  string m_path;
-  
-};
-
-#endif /* LWIP_UTILS_H */