Fork HTTPClient and Modfiy code for mbed 6.0

Dependents:   mbed-demo-http-get-json

Committer:
WiredHome
Date:
Sat Mar 15 18:40:29 2014 +0000
Revision:
23:517fec8b8b99
Child:
24:eee214e3e806
Added HTTPFile methods

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 23:517fec8b8b99 1 #include "HTTPFile.h"
WiredHome 23:517fec8b8b99 2 #if 0
WiredHome 23:517fec8b8b99 3 HTTPFile::HTTPFile(char* filename) {
WiredHome 23:517fec8b8b99 4 file = fopen(filename, "w");
WiredHome 23:517fec8b8b99 5 }
WiredHome 23:517fec8b8b99 6
WiredHome 23:517fec8b8b99 7 void HTTPFile::close() {
WiredHome 23:517fec8b8b99 8 if (file) {
WiredHome 23:517fec8b8b99 9 fclose(file);
WiredHome 23:517fec8b8b99 10 }
WiredHome 23:517fec8b8b99 11 }
WiredHome 23:517fec8b8b99 12
WiredHome 23:517fec8b8b99 13 void HTTPFile::writeReset() {
WiredHome 23:517fec8b8b99 14 if (file) {
WiredHome 23:517fec8b8b99 15 rewind(file);
WiredHome 23:517fec8b8b99 16 }
WiredHome 23:517fec8b8b99 17 }
WiredHome 23:517fec8b8b99 18
WiredHome 23:517fec8b8b99 19 int HTTPFile::write(const char* buf, size_t len) {
WiredHome 23:517fec8b8b99 20 if (file) {
WiredHome 23:517fec8b8b99 21 len = fwrite(&buf, 1, len, file);
WiredHome 23:517fec8b8b99 22 if ((!m_chunked && (ftell(file) >= m_len)) || (m_chunked && !len)) {
WiredHome 23:517fec8b8b99 23 close();
WiredHome 23:517fec8b8b99 24 }
WiredHome 23:517fec8b8b99 25 }
WiredHome 23:517fec8b8b99 26 return len;
WiredHome 23:517fec8b8b99 27 }
WiredHome 23:517fec8b8b99 28
WiredHome 23:517fec8b8b99 29 void HTTPFile::setDataType(const char* type) {
WiredHome 23:517fec8b8b99 30
WiredHome 23:517fec8b8b99 31 }
WiredHome 23:517fec8b8b99 32
WiredHome 23:517fec8b8b99 33 void HTTPFile::setIsChunked(bool chunked) {
WiredHome 23:517fec8b8b99 34 m_chunked = chunked;
WiredHome 23:517fec8b8b99 35 }
WiredHome 23:517fec8b8b99 36
WiredHome 23:517fec8b8b99 37 void HTTPFile::setDataLen(size_t len) {
WiredHome 23:517fec8b8b99 38 m_len = len;
WiredHome 23:517fec8b8b99 39 }
WiredHome 23:517fec8b8b99 40 #endif