HTTP Client data container for form(multipart/form-data)

Dependencies:   mbed EthernetInterface HTTPClient mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
va009039
Date:
Tue Aug 28 14:39:29 2012 +0000
Parent:
0:fcd577a3925b
Commit message:
update to using new HTTPClient

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient/LPC1768/HTTPClient.ar Show diff for this revision Revisions of this file
HTTPClient/LPC1768/dbg/dbg.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/HTTPClient.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/HTTPData.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/data/HTTPFile.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/data/HTTPMap.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/data/HTTPStream.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/client/data/HTTPText.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/util/base64.h Show diff for this revision Revisions of this file
HTTPClient/LPC1768/services/http/util/url.h Show diff for this revision Revisions of this file
HTTPNull.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPNull.h Show annotated file Show diff for this revision Revisions of this file
HTTPPoster.cpp Show annotated file Show diff for this revision Revisions of this file
HTTPPoster.h Show annotated file Show diff for this revision Revisions of this file
NetServicesMin.lib Show diff for this revision Revisions of this file
file_upload.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Tue Aug 28 14:39:29 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#a0ee3ae75cfa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Tue Aug 28 14:39:29 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPClient/#be61104f4e91
Binary file HTTPClient/LPC1768/HTTPClient.ar has changed
--- a/HTTPClient/LPC1768/dbg/dbg.h	Thu May 31 10:32:39 2012 +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/HTTPClient/LPC1768/services/http/client/HTTPClient.h	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +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 Client header file
-*/
-
-#ifndef HTTP_CLIENT_H
-#define HTTP_CLIENT_H
-
-class HTTPData;
-
-#include "core/net.h"
-#include "api/TCPSocket.h"
-#include "api/DNSRequest.h"
-#include "HTTPData.h"
-#include "mbed.h"
-
-#include <string>
-using std::string;
-
-#include <map>
-using std::map;
-
-///HTTP client results
-enum HTTPResult
-{
-  HTTP_OK, ///<Success
-  HTTP_PROCESSING, ///<Processing
-  HTTP_PARSE, ///<URI Parse error
-  HTTP_DNS, ///<Could not resolve name
-  HTTP_PRTCL, ///<Protocol error
-  HTTP_NOTFOUND, ///<HTTP 404 Error
-  HTTP_REFUSED, ///<HTTP 403 Error
-  HTTP_ERROR, ///<HTTP xxx error
-  HTTP_TIMEOUT, ///<Connection timeout
-  HTTP_CONN ///<Connection error
-};
-
-#include "core/netservice.h"
-
-///A simple HTTP Client
-/**
-The HTTPClient is composed of:
-- The actual client (HTTPClient)
-- Classes that act as a data repository, each of which deriving from the HTTPData class (HTTPText for short text content, HTTPFile for file I/O, HTTPMap for key/value pairs, and HTTPStream for streaming purposes)
-*/
-class HTTPClient : protected NetService
-{
-public:
-  ///Instantiates the HTTP client
-  HTTPClient();
-  virtual ~HTTPClient();
-  
-  ///Provides a basic authentification feature (Base64 encoded username and password)
-  void basicAuth(const char* user, const char* password); //Basic Authentification
-  
-  //High Level setup functions
-  ///Executes a GET Request (blocking)
-  /**
-  Executes a GET request on the URI uri
-  @param uri : URI on which to execute the request
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  Blocks until completion
-  */
-  HTTPResult get(const char* uri, HTTPData* pDataIn); //Blocking
-  
-  ///Executes a GET Request (non blocking)
-  /**
-  Executes a GET request on the URI uri
-  @param uri : URI on which to execute the request
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  @param pMethod : callback function
-  The function returns immediately and calls the callback on completion or error
-  */
-  HTTPResult get(const char* uri, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking
-  
-  ///Executes a GET Request (non blocking)
-  /**
-  Executes a GET request on the URI uri
-  @param uri : URI on which to execute the request
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  @param pItem : instance of class on which to execute the callback method
-  @param pMethod : callback method
-  The function returns immediately and calls the callback on completion or error
-  */
-  template<class T> 
-  HTTPResult get(const char* uri, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking
-  {
-    setOnResult(pItem, pMethod);
-    doGet(uri, pDataIn);
-    return HTTP_PROCESSING;
-  }
-  
-  ///Executes a POST Request (blocking)
-  /**
-  Executes a POST request on the URI uri
-  @param uri : URI on which to execute the request
-  @param dataOut : a HTTPData instance that contains the data that will be posted
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  Blocks until completion
-  */
-  HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); //Blocking
-  
-  ///Executes a POST Request (non blocking)
-  /**
-  Executes a POST request on the URI uri
-  @param uri : URI on which to execute the request
-  @param dataOut : a HTTPData instance that contains the data that will be posted
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  @param pMethod : callback function
-  The function returns immediately and calls the callback on completion or error
-  */
-  HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking
-  
-  ///Executes a POST Request (non blocking)
-  /**
-  Executes a POST request on the URI uri
-  @param uri : URI on which to execute the request
-  @param dataOut : a HTTPData instance that contains the data that will be posted
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  @param pItem : instance of class on which to execute the callback method
-  @param pMethod : callback method
-  The function returns immediately and calls the callback on completion or error
-  */
-  template<class T> 
-  HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking  
-  {
-    setOnResult(pItem, pMethod);
-    doPost(uri, dataOut, pDataIn);
-    return HTTP_PROCESSING;
-  }
-
-  ///Executes a GET Request (non blocking)
-  /**
-  Executes a GET request on the URI uri
-  @param uri : URI on which to execute the request
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  The function returns immediately and calls the previously set callback on completion or error
-  */  
-  void doGet(const char* uri, HTTPData* pDataIn);  
-  
-  ///Executes a POST Request (non blocking)
-  /**
-  Executes a POST request on the URI uri
-  @param uri : URI on which to execute the request
-  @param dataOut : a HTTPData instance that contains the data that will be posted
-  @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL
-  @param pMethod : callback function
-  The function returns immediately and calls the previously set callback on completion or error
-  */
-  void doPost(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); 
-  
-  ///Setups the result callback
-  /**
-  @param pMethod : callback function
-  */
-  void setOnResult( void (*pMethod)(HTTPResult) );
-  
-  ///Setups the result callback
-  /**
-  @param pItem : instance of class on which to execute the callback method
-  @param pMethod : callback method
-  */
-  class CDummy;
-  template<class T> 
-  void setOnResult( T* pItem, void (T::*pMethod)(HTTPResult) )
-  {
-    m_pCb = NULL;
-    m_pCbItem = (CDummy*) pItem;
-    m_pCbMeth = (void (CDummy::*)(HTTPResult)) pMethod;
-  }
-
-  ///Setups timeout
-  /**
-  @param ms : time of connection inactivity in ms after which the request should timeout
-  */
-  void setTimeout(int ms);
-  
-  virtual void poll(); //Called by NetServices
-  
-  ///Gets last request's HTTP response code
-  /**
-  @return The HTTP response code of the last request
-  */
-  int getHTTPResponseCode();
-  
-  ///Sets a specific request header
-  void setRequestHeader(const string& header, const string& value);
-  
-  ///Gets a response header
-  string& getResponseHeader(const string& header);
-  
-  ///Clears request headers
-  void resetRequestHeaders();
-  
-protected:
-  void resetTimeout();
-  
-  void init();
-  void close();
-  
-  void setup(const char* uri, HTTPData* pDataOut, HTTPData* pDataIn); //Setup request, make DNS Req if necessary
-  void connect(); //Start Connection
-  
-  int  tryRead(); //Read data and try to feed output
-  void readData(); //Data has been read
-  void writeData(); //Data has been written & buf is free
-  
-  void onTCPSocketEvent(TCPSocketEvent e);
-  void onDNSReply(DNSReply r);
-  void onResult(HTTPResult r); //Called when exchange completed or on failure
-  void onTimeout(); //Connection has timed out
-  
-private:
-  HTTPResult blockingProcess(); //Called in blocking mode, calls Net::poll() until return code is available
-
-  bool readHeaders(); //Called first when receiving data
-  bool writeHeaders(); //Called to create req
-  int readLine(char* str, int maxLen, bool* pIncomplete = NULL);
-  
-  enum HTTP_METH
-  {
-    HTTP_GET,
-    HTTP_POST,
-    HTTP_HEAD
-  };
-  
-  HTTP_METH m_meth;
-  
-  CDummy* m_pCbItem;
-  void (CDummy::*m_pCbMeth)(HTTPResult);
-  
-  void (*m_pCb)(HTTPResult);
-  
-  TCPSocket* m_pTCPSocket;
-  map<string, string> m_reqHeaders;
-  map<string, string> m_respHeaders;
-  
-  Timer m_watchdog;
-  int m_timeout;
-  
-  DNSRequest* m_pDnsReq;
-  
-  Host m_server;
-  string m_path;
-  
-  bool m_closed;
-  
-  enum HTTPStep
-  {
-   // HTTP_INIT,
-    HTTP_WRITE_HEADERS,
-    HTTP_WRITE_DATA,
-    HTTP_READ_HEADERS,
-    HTTP_READ_DATA,
-    HTTP_READ_DATA_INCOMPLETE,
-    HTTP_DONE,
-    HTTP_CLOSED
-  };
-  
-  HTTPStep m_state;
-  
-  HTTPData* m_pDataOut;
-  HTTPData* m_pDataIn;
-  
-  bool m_dataChunked; //Data is encoded as chunks
-  int m_dataPos; //Position in data
-  int m_dataLen; //Data length
-  char* m_buf;
-  char* m_pBufRemaining; //Remaining
-  int m_bufRemainingLen; //Data length in m_pBufRemaining
-  
-  int m_httpResponseCode;
-  
-  HTTPResult m_blockingResult; //Result if blocking mode
-  
-};
-
-//Including data containers here for more convenience
-#include "data/HTTPFile.h"
-#include "data/HTTPStream.h"
-#include "data/HTTPText.h"
-#include "data/HTTPMap.h"
-
-#endif
--- a/HTTPClient/LPC1768/services/http/client/HTTPData.h	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +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_DATA_H
-#define HTTP_DATA_H
-
-#include "core/net.h"
-
-#include <string>
-using std::string;
-
-class HTTPData //This is a simple interface for HTTP data storage (impl examples are Key/Value Pairs, File, etc...)
-{
-public:
-  HTTPData();
-  virtual ~HTTPData();
-  
-  virtual void clear() = 0;
-
-protected:
-  friend class HTTPClient;
-  virtual int read(char* buf, int len) = 0;
-  virtual int write(const char* buf, int len) = 0;
-  
-  virtual string getDataType() = 0; //Internet media type for Content-Type header
-  virtual void setDataType(const string& type) = 0; //Internet media type from Content-Type header
-  
-  virtual bool getIsChunked() = 0; //For Transfer-Encoding header
-  virtual void setIsChunked(bool chunked) = 0; //From Transfer-Encoding header
-  
-  virtual int getDataLen() = 0; //For Content-Length header
-  virtual void setDataLen(int len) = 0; //From Content-Length header, or if the transfer is chunked, next chunk length
-  
-private:
-
-};
-
-#endif
--- a/HTTPClient/LPC1768/services/http/client/data/HTTPFile.h	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +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 File data source/sink header file
-*/
-
-#ifndef HTTP_FILE_H
-#define HTTP_FILE_H
-
-#include "../HTTPData.h"
-#include "mbed.h"
-
-///HTTP Client data container for files
-/**
-This class provides file access/storage for HTTP requests and responses' data payloads.
-
-
-*/
-class HTTPFile : public HTTPData //Read or Write data from a file
-{
-public:
-  ///Instantiates data source/sink with file in param.
-  /**
-  Uses file at path @a path.
-  It will be opened when some data has to be read/written from/to it and closed when this operation is complete or on destruction of the instance.
-  Note that the file will be opened with mode "w" for writing and mode "r" for reading, so the file will be cleared between each request if you are using it for writing.
-  
-  @note
-  Note that to use this you must instantiate a proper file system (such as the LocalFileSystem or the SDFileSystem).
-  */
-  HTTPFile(const char* path);
-  virtual ~HTTPFile();
-  
-  ///Forces file closure
-  virtual void clear();
-
-protected:
-  virtual int read(char* buf, int len);
-  virtual int write(const char* buf, int len);
-  
-  virtual string getDataType(); //Internet media type for Content-Type header
-  virtual void setDataType(const string& type); //Internet media type from Content-Type header
-  
-  virtual bool getIsChunked(); //For Transfer-Encoding header
-  virtual void setIsChunked(bool chunked); //From Transfer-Encoding header  virtual
-  
-  virtual int getDataLen(); //For Content-Length header
-  virtual void setDataLen(int len); //From Content-Length header
-  
-private:
-  bool openFile(const char* mode); //true on success, false otherwise
-  void closeFile();
-
-  FILE* m_fp;
-  string m_path;
-  int m_len;
-  bool m_chunked;
-};
-
-#endif
--- a/HTTPClient/LPC1768/services/http/client/data/HTTPMap.h	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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 Map data source/sink header file
-*/
-
-#ifndef HTTP_MAP_H
-#define HTTP_MAP_H
-
-#include "../HTTPData.h"
-#include "mbed.h"
-
-#include <map>
-using std::map;
-
-typedef map<string, string> Dictionary;
-
-///HTTP Client data container for key/value pairs
-/**
-This class simplifies the use of key/value pairs requests and responses used widely among web APIs.
-Note that HTTPMap inherits from std::map<std::string,std::string>.
-You can therefore use any public method of that class, including the square brackets operator ( [ ] ) to access a value.
-
-The data is encoded or decoded to/from a key/value pairs-formatted string, after url-encoding/decoding.
-*/
-class HTTPMap : public HTTPData, public Dictionary //Key/Value pairs
-{
-public:
-  ///Instantiates map
-  /**
-  @param keyValueSep Key/Value separator (defaults to "=")
-  @param pairSep Pairs separator (defaults to "&")
-  */
-  HTTPMap(const string& keyValueSep = "=", const string& pairSep = "&");
-  virtual ~HTTPMap();
-  
- /* string& operator[](const string& key);
-  int count();*/
-
-  ///Clears the content
-  virtual void clear();  
-  
-protected:
-  virtual int read(char* buf, int len);
-  virtual int write(const char* buf, int len);
-  
-  virtual string getDataType(); //Internet media type for Content-Type header
-  virtual void setDataType(const string& type); //Internet media type from Content-Type header
-  
-  virtual bool getIsChunked(); //For Transfer-Encoding header
-  virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
-  
-  virtual int getDataLen(); //For Content-Length header
-  virtual void setDataLen(int len); //From Content-Length header
-  
-private:
-  void generateString();
-  void parseString();
-  //map<string, string> m_map;
-  string m_buf;
-  int m_len;
-  bool m_chunked;
-  
-  string m_keyValueSep;
-  string m_pairSep;
-};
-
-#endif
--- a/HTTPClient/LPC1768/services/http/client/data/HTTPStream.h	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +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_STREAM_H
-#define HTTP_STREAM_H
-
-#include "../HTTPData.h"
-#include "mbed.h"
-
-/** \file
-HTTP Stream data source/sink header file
-*/
-
-typedef uint8_t byte;
-
-///HTTP Client Streaming tool
-/**
-This class allows you to stream data from the web using a persisting HTTP connection.
-To use it properly you must use a non-blocking HTTPClient method.
-*/
-class HTTPStream : public HTTPData //Streaming buf
-{
-public:
-  ///Instantiates the object
-  HTTPStream();
-  virtual ~HTTPStream();
-  
-  ///Starts to read into buffer
-  /**
-  Passes a buffer of address @a buf and size @a size to the instance.
-  When it receives data it will be stored in this buffer.
-  When the buffer is full it throttles the client until this function is called again.
-  */
-  void readNext(byte* buf, int size);
-  
-  ///Returns whether there is data available to read
-  bool readable();
-  
-  ///Returns the actual length of the payload written in the buffer
-  int readLen();
-  
-  virtual void clear();
-      
-protected:
-  virtual int read(char* buf, int len);
-  virtual int write(const char* buf, int len);
-  
-  virtual string getDataType(); //Internet media type for Content-Type header
-  virtual void setDataType(const string& type); //Internet media type from Content-Type header
-
-  virtual bool getIsChunked(); //For Transfer-Encoding header
-  virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
-  
-  virtual int getDataLen(); //For Content-Length header
-  virtual void setDataLen(int len); //From Content-Length header, or if the transfer is chunked, next chunk length
-  
-private:
-  byte* m_buf;
-  int m_size; //Capacity
-  int m_len; //Length
-};
-
-#endif
--- a/HTTPClient/LPC1768/services/http/client/data/HTTPText.h	Thu May 31 10:32:39 2012 +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.
-*/
-
-/** \file
-HTTP Text data source/sink header file
-*/
-
-#ifndef HTTP_TEXT_H
-#define HTTP_TEXT_H
-
-#include "../HTTPData.h"
-#include "mbed.h"
-
-#define DEFAULT_MAX_MEM_ALLOC 512 //Avoid out-of-memory problems
-
-///HTTP Client data container for text
-/**
-This is a simple "Text" data repository for HTTP requests.
-*/
-class HTTPText : public HTTPData //Simple Text I/O
-{
-public:
-  ///Instantiates the object.
-  /**
-  @param encoding encoding of the data, it defaults to text/html.
-  @param maxSize defines the maximum memory size that can be allocated by the object. It defaults to 512 bytes.
-  */
-  HTTPText(const string& encoding = "text/html", int maxSize = DEFAULT_MAX_MEM_ALLOC);
-  virtual ~HTTPText();
-  
-  ///Gets text
-  /**
-  Returns the text in the container as a zero-terminated char*.
-  The array returned points to the internal buffer of the object and remains owned by the object.
-  */
-  const char* gets() const;
-  
-  //Puts text
-  /**
-  Sets the text in the container using a zero-terminated char*.
-  */
-  void puts(const char* str);
-  
-  ///Gets text
-  /**
-  Returns the text in the container as string.
-  */
-  string& get();
-  
-  ///Puts text
-  /**
-  Sets the text in the container as string.
-  */
-  void set(const string& str);
-  
-  ///Clears the content.
-  /**
-  If this container is used as a data sink, it is cleared by the HTTP Client at the beginning of the request.
-  */
-  virtual void clear();
-  
-protected:
-  virtual int read(char* buf, int len);
-  virtual int write(const char* buf, int len);
-  
-  virtual string getDataType(); //Internet media type for Content-Type header
-  virtual void setDataType(const string& type); //Internet media type from Content-Type header
-
-  virtual bool getIsChunked(); //For Transfer-Encoding header
-  virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
-  
-  virtual int getDataLen(); //For Content-Length header
-  virtual void setDataLen(int len); //From Content-Length header, or if the transfer is chunked, next chunk length
-  
-private:
-  string m_buf;
-  string m_encoding;
-  int m_maxSize;
-};
-
-#endif
--- a/HTTPClient/LPC1768/services/http/util/base64.h	Thu May 31 10:32:39 2012 +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/HTTPClient/LPC1768/services/http/util/url.h	Thu May 31 10:32:39 2012 +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 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPNull.cpp	Tue Aug 28 14:39:29 2012 +0000
@@ -0,0 +1,48 @@
+/* HTTPNull.cpp */
+//Debug is disabled by default
+#if 1
+//Enable debug
+#include <cstdio>
+#define DBG(x, ...) std::printf("[HTTPNull : DBG]"x"\r\n", ##__VA_ARGS__); 
+//#define DBG(x, ...) 
+#define WARN(x, ...) std::printf("[HTTPNull : WARN]"x"\r\n", ##__VA_ARGS__); 
+#define ERR(x, ...) std::printf("[HTTPNull : ERR]"x"\r\n", ##__VA_ARGS__); 
+
+#else
+//Disable debug
+#define DBG(x, ...) 
+#define WARN(x, ...)
+#define ERR(x, ...) 
+
+#endif
+
+#include "HTTPNull.h"
+
+#define OK 0
+
+HTTPNull::HTTPNull()
+{
+
+}
+
+//IHTTPDataOut
+/*virtual*/ int HTTPNull::write(const char* buf, size_t len)
+{
+    DBG("write(%p, %d)", buf, len);
+    return OK;
+}
+
+/*virtual*/ void HTTPNull::setDataType(const char* type) //Internet media type from Content-Type header
+{
+    DBG("setDataType(%s)", type);
+}
+
+/*virtual*/ void HTTPNull::setIsChunked(bool chunked) //From Transfer-Encoding header
+{
+
+}
+
+/*virtual*/ void HTTPNull::setDataLen(size_t len) //From Content-Length header, or if the transfer is chunked, next chunk length
+{
+    DBG("setDataLen(%d)", len);   
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPNull.h	Tue Aug 28 14:39:29 2012 +0000
@@ -0,0 +1,19 @@
+/* HTTPNull.h */
+#ifndef HTTPNULL_H_
+#define HTTPNULL_H_
+
+#include "../IHTTPData.h"
+
+class HTTPNull : public IHTTPDataIn
+{
+public:
+  HTTPNull();
+protected:
+  //IHTTPDataIn
+  virtual int write(const char* buf, size_t len);
+  virtual void setDataType(const char* type); //Internet media type from Content-Type header
+  virtual void setIsChunked(bool chunked); //From Transfer-Encoding header
+  virtual void setDataLen(size_t len); //From Content-Length header, or if the transfer is chunked, next chunk length
+};
+
+#endif // HTTPNULL_H_
--- a/HTTPPoster.cpp	Thu May 31 10:32:39 2012 +0000
+++ b/HTTPPoster.cpp	Tue Aug 28 14:39:29 2012 +0000
@@ -1,49 +1,42 @@
+/* HTTPPoster.cpp */
 
-/*
-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.
-*/
+//Debug is disabled by default
+#if 1
+//Enable debug
+#include <cstdio>
+#define DBG(x, ...) std::printf("[HTTPPoster : DBG]"x"\r\n", ##__VA_ARGS__); 
+//#define DBG(x, ...) 
+#define WARN(x, ...) std::printf("[HTTPPoster : WARN]"x"\r\n", ##__VA_ARGS__); 
+#define ERR(x, ...) std::printf("[HTTPPoster : ERR]"x"\r\n", ##__VA_ARGS__); 
+
+#else
+//Disable debug
+#define DBG(x, ...) 
+#define WARN(x, ...)
+#define ERR(x, ...) 
+
+#endif
 
 #include "HTTPPoster.h"
-//#define __DEBUG
-//#include "mydbg.h"
-#include "dbg/dbg.h"
+
+#define OK 0
 
 ///HTTP Client data container for form(multipart/form-data)
 HTTPPoster::HTTPPoster()
 {
-    DBG("\n");
     m_cur = 0;
     m_seq = 0;
     m_send_len = 0;
     m_fp = NULL;
     m_post_data.clear();
     m_buf.clear();
-    m_boundary = "----mbedHTTPClientPoster";
+    m_boundary = "----HTTPPoster123";
     m_ContentType = "multipart/form-data; boundary="; 
     m_ContentType += m_boundary;
 }
 
 HTTPPoster::~HTTPPoster()
 {
-    DBG("m_post_data.size()=%d\n", m_post_data.size());
     if (m_fp) {
         fclose(m_fp);
         m_fp = NULL;
@@ -52,7 +45,6 @@
 
 bool HTTPPoster::addFile(const char* name, const char* path)
 {
-    DBG("%p name=%s path=%s\n", this, name, path);
     struct stpost data;
 
     m_fp = fopen(path, "rb");
@@ -78,7 +70,6 @@
 
 bool HTTPPoster::add(const char* name, const char* value)
 {
-    DBG("%p name=%s value=%s\n", this, name, value);
     struct stpost data;
 
     string head = "Content-Disposition: form-data; name=\"";
@@ -93,9 +84,8 @@
     return true;
 }
 
-int HTTPPoster::read(char* buf, int len)
+/*virtual*/ int HTTPPoster::read(char* buf, size_t len, size_t* pReadLen)
 {
-    //DBG("buf=%p len=%d\n", buf, len);
     int c;
     switch(m_seq) {
         case 0:
@@ -157,18 +147,28 @@
     memcpy(buf, m_buf.data(), len2);
     m_buf.erase(0, len2);
     m_send_len += len2;
-    DBG("m_len=%d m_send_len=%d len=%d len2=%d\n", m_len, m_send_len, len, len2);
-    //DBG_HEX((uint8_t*)buf, len2);
-    return len2;
+    DBG("m_len=%d m_send_len=%d len=%d len2=%d", m_len, m_send_len, len, len2);
+    *pReadLen = len2;
+    return OK;
 }
 
-string HTTPPoster::getDataType() //Internet media type for Content-Type header
+/*virtual*/ int HTTPPoster::getDataType(char* type, size_t maxTypeLen) //Internet media type for Content-Type header
 {
-    DBG("%s\n", m_ContentType.c_str());
-    return m_ContentType;
+    if (m_ContentType.length() >= maxTypeLen) {
+        WARN("maxTypeLen=%d", maxTypeLen);
+        WARN("m_ContentType.length()=%d", m_ContentType.length());
+        return !OK;
+    }
+    strcpy(type, m_ContentType.c_str());
+    return OK;
 }
 
-int HTTPPoster::getDataLen() //For Content-Length header
+/*virtual*/ bool HTTPPoster::getIsChunked() //For Transfer-Encoding header
+{
+    return false; ////Data is computed one key/value pair at a time
+}
+
+/*virtual*/ size_t HTTPPoster::getDataLen() //For Content-Length header
 {
     m_len = 0;
     for(int i = 0; i < m_post_data.size(); i++) {
@@ -177,7 +177,6 @@
         m_len += 2;                               // CRLF  
         m_len += m_post_data[i].length;           // value / file body
         m_len += 2;                               // CRLF
-        DBG("%d m_len=%d\n", i, m_len);
     }
     m_len += 2 + strlen(m_boundary) + 2 + 2;   // "--" boundary "--" CRLF
     return m_len;
--- a/HTTPPoster.h	Thu May 31 10:32:39 2012 +0000
+++ b/HTTPPoster.h	Tue Aug 28 14:39:29 2012 +0000
@@ -1,7 +1,11 @@
+/* HTTPPoster.h */
 #ifndef HTTP_POSTER_H
 #define HTTP_POSTER_H
+
+#include "../IHTTPData.h"
+
 #include "mbed.h"
-#include "HTTPData.h"
+#include <string>
 #include <vector>
 
 /** HTTPPoster HTTP Client data container for form(multipart/form-data)
@@ -25,27 +29,24 @@
 };
 
 ///HTTPPoster HTTP Client data container for form(multipart/form-data)
-class HTTPPoster : public HTTPData
+class HTTPPoster : public IHTTPDataOut
 {
 public:
-    ///Instantiates the object.
-    HTTPPoster();
-    ///put file
-    bool addFile(const char* name, const char* path);
-    ///put param
-    bool add(const char* name, const char* value);
+  ///Instantiates the object.
+  HTTPPoster();
+  ///put file
+  bool addFile(const char* name, const char* path);
+  ///put param
+  bool add(const char* name, const char* value);
 
-    virtual ~HTTPPoster();
-    virtual void clear() {};
+  virtual ~HTTPPoster();
 protected:
-    virtual string getDataType();
-    virtual int getDataLen();
-    virtual int read(char* buf, int len);
-    virtual int write(const char* buf, int len) { return 0;}
-    virtual void setDataType(const string& type) {}
-    virtual bool getIsChunked() {return false;}
-    virtual void setIsChunked(bool chunked) {}
-    virtual void setDataLen(int len) {}
+  //IHTTPDataOut
+  virtual int read(char* buf, size_t len, size_t* pReadLen);
+  virtual int getDataType(char* type, size_t maxTypeLen); //Internet media type for Content-Type header
+  virtual bool getIsChunked(); //For Transfer-Encoding header
+  virtual size_t getDataLen(); //For Content-Length header
+
 private:
   int m_seq;
   int m_cur;
@@ -58,4 +59,5 @@
   string m_ContentType;
   char* m_boundary;
 };
-#endif
+
+#endif // HTTP_POSTER_H
--- a/NetServicesMin.lib	Thu May 31 10:32:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/hlipka/code/NetServicesMin/#8b387bed54c2
--- a/file_upload.cpp	Thu May 31 10:32:39 2012 +0000
+++ b/file_upload.cpp	Tue Aug 28 14:39:29 2012 +0000
@@ -1,29 +1,35 @@
 #include "mbed.h"
-#include "EthernetNetIf.h"
+#include "EthernetInterface.h"
 #include "HTTPClient.h"
 #include "HTTPPoster.h"
+#include "HTTPNull.h"
+
+Serial pc(USBTX, USBRX);
 
 LocalFileSystem local("local"); 
 
-Serial pc(USBTX, USBRX);
-
-EthernetNetIf eth;
+EthernetInterface eth;
+HTTPClient http;
 
 int main() {
     pc.baud(921600);
-
-    int ethErr = eth.setup();
-    if(ethErr) {printf("Error %d in setup.\n", ethErr); exit(1);}
+    printf("%s\n", __FILE__);
 
-    HTTPClient client;
+    eth.init(); //Use DHCP
+    eth.connect();
+
     HTTPPoster data;
-    data.addFile("image", "/local/image.jpg");
+    HTTPNull text_null;
+    data.addFile("image", "/local/image1.jpg");
     data.add("title", "hello");
     string url = "http://va009039.appspot.com/mbed/upload/";
     
-    HTTPResult r = client.post(url.c_str(), data, NULL);
-
-    printf("result:%d HTTPResponseCode: %d\n", r, client.getHTTPResponseCode());
+    HTTPResult ret = http.post(url.c_str(), data, &text_null);
+    if (!ret) {
+      printf("Executed POST successfully\n");
+    } else {
+      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
+    }
 
     exit(1);    
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Aug 28 14:39:29 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#9654a71f5a90
--- a/mbed.bld	Thu May 31 10:32:39 2012 +0000
+++ b/mbed.bld	Tue Aug 28 14:39:29 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479
+http://mbed.org/users/mbed_official/code/mbed/builds/10b9abbe79a6
\ No newline at end of file