Student project by David Berlin and Boris Dogadov made for the Embedded Systems Workshop course given in Tel-Aviv University on 2010 by Sivan Toledo. Visit the project website for more details: http://davidberlin.co.il/sadna/ .

Dependencies:   EthernetNetIf NTPClient_NetServices mbed HTTPServer HTTPClient CyaSSL

Dropbox/HTTPFileSender.h

Committer:
sivan_toledo
Date:
2011-04-25
Revision:
1:b05231650f32
Parent:
0:3e7d6f496a67

File content as of revision 1:b05231650f32:

#include "HTTPData.h"
#include "HTTPClient.h"

// uploads a local file using multipart encoding
class HTTPFileSender : public HTTPData
{
 public:
  HTTPFileSender(const char *fileName, const char* dstFile);  
  virtual ~HTTPFileSender();
  virtual void clear();
  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:
    FILE *file; 
    
    int pos;
    int totalLen;
    int fileLen;
    
    int headerSize;
    int footerSize;
    
    static char header[256];
    static char footer[128];
};