NetServices Stack source
Dependents: HelloWorld ServoInterfaceBoardExample1 4180_Lab4
services/http/client/HTTPClient.h@6:b7dd7cde8ad2, 2010-07-28 (annotated)
- Committer:
- donatien
- Date:
- Wed Jul 28 10:18:21 2010 +0000
- Revision:
- 6:b7dd7cde8ad2
- Parent:
- 5:dd63a1e02b1b
- Child:
- 9:c79fa4034f5b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:632c9925f013 | 1 | |
donatien | 0:632c9925f013 | 2 | /* |
donatien | 0:632c9925f013 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
donatien | 0:632c9925f013 | 4 | |
donatien | 0:632c9925f013 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
donatien | 0:632c9925f013 | 6 | of this software and associated documentation files (the "Software"), to deal |
donatien | 0:632c9925f013 | 7 | in the Software without restriction, including without limitation the rights |
donatien | 0:632c9925f013 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
donatien | 0:632c9925f013 | 9 | copies of the Software, and to permit persons to whom the Software is |
donatien | 0:632c9925f013 | 10 | furnished to do so, subject to the following conditions: |
donatien | 0:632c9925f013 | 11 | |
donatien | 0:632c9925f013 | 12 | The above copyright notice and this permission notice shall be included in |
donatien | 0:632c9925f013 | 13 | all copies or substantial portions of the Software. |
donatien | 0:632c9925f013 | 14 | |
donatien | 0:632c9925f013 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:632c9925f013 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:632c9925f013 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:632c9925f013 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:632c9925f013 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:632c9925f013 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
donatien | 0:632c9925f013 | 21 | THE SOFTWARE. |
donatien | 0:632c9925f013 | 22 | */ |
donatien | 0:632c9925f013 | 23 | |
donatien | 6:b7dd7cde8ad2 | 24 | /** \file |
donatien | 6:b7dd7cde8ad2 | 25 | HTTP Client header file |
donatien | 6:b7dd7cde8ad2 | 26 | */ |
donatien | 6:b7dd7cde8ad2 | 27 | |
donatien | 0:632c9925f013 | 28 | #ifndef HTTP_CLIENT_H |
donatien | 0:632c9925f013 | 29 | #define HTTP_CLIENT_H |
donatien | 0:632c9925f013 | 30 | |
donatien | 0:632c9925f013 | 31 | class HTTPData; |
donatien | 0:632c9925f013 | 32 | |
donatien | 0:632c9925f013 | 33 | #include "if/net/net.h" |
donatien | 0:632c9925f013 | 34 | #include "api/TCPSocket.h" |
donatien | 0:632c9925f013 | 35 | #include "api/DNSRequest.h" |
donatien | 0:632c9925f013 | 36 | #include "HTTPData.h" |
donatien | 0:632c9925f013 | 37 | #include "mbed.h" |
donatien | 0:632c9925f013 | 38 | |
donatien | 0:632c9925f013 | 39 | #include <string> |
donatien | 0:632c9925f013 | 40 | using std::string; |
donatien | 0:632c9925f013 | 41 | |
donatien | 0:632c9925f013 | 42 | #include <map> |
donatien | 0:632c9925f013 | 43 | using std::map; |
donatien | 0:632c9925f013 | 44 | |
donatien | 5:dd63a1e02b1b | 45 | ///HTTP client results |
donatien | 0:632c9925f013 | 46 | enum HTTPResult |
donatien | 0:632c9925f013 | 47 | { |
donatien | 6:b7dd7cde8ad2 | 48 | HTTP_OK, ///<Success |
donatien | 6:b7dd7cde8ad2 | 49 | HTTP_PROCESSING, ///<Processing |
donatien | 6:b7dd7cde8ad2 | 50 | HTTP_PARSE, ///<URI Parse error |
donatien | 6:b7dd7cde8ad2 | 51 | HTTP_DNS, ///<Could not resolve name |
donatien | 6:b7dd7cde8ad2 | 52 | HTTP_PRTCL, ///<Protocol error |
donatien | 6:b7dd7cde8ad2 | 53 | HTTP_NOTFOUND, ///<HTTP 404 Error |
donatien | 6:b7dd7cde8ad2 | 54 | HTTP_REFUSED, ///<HTTP 403 Error |
donatien | 6:b7dd7cde8ad2 | 55 | HTTP_ERROR, ///<HTTP xxx error |
donatien | 6:b7dd7cde8ad2 | 56 | HTTP_TIMEOUT, ///<Connection timeout |
donatien | 6:b7dd7cde8ad2 | 57 | HTTP_CONN ///<Connection error |
donatien | 0:632c9925f013 | 58 | }; |
donatien | 0:632c9925f013 | 59 | |
donatien | 5:dd63a1e02b1b | 60 | ///A simple HTTP Client |
donatien | 5:dd63a1e02b1b | 61 | /** |
donatien | 5:dd63a1e02b1b | 62 | The HTTPClient is composed of: |
donatien | 5:dd63a1e02b1b | 63 | - The actual client (HTTPClient) |
donatien | 5:dd63a1e02b1b | 64 | - 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) |
donatien | 5:dd63a1e02b1b | 65 | */ |
donatien | 0:632c9925f013 | 66 | class HTTPClient : protected NetService |
donatien | 0:632c9925f013 | 67 | { |
donatien | 0:632c9925f013 | 68 | public: |
donatien | 5:dd63a1e02b1b | 69 | ///Instantiates the HTTP client |
donatien | 0:632c9925f013 | 70 | HTTPClient(); |
donatien | 0:632c9925f013 | 71 | virtual ~HTTPClient(); |
donatien | 0:632c9925f013 | 72 | |
donatien | 5:dd63a1e02b1b | 73 | ///Provides a basic authentification feature (Base64 encoded username and password) |
donatien | 0:632c9925f013 | 74 | void basicAuth(const char* user, const char* password); //Basic Authentification |
donatien | 0:632c9925f013 | 75 | |
donatien | 0:632c9925f013 | 76 | //High Level setup functions |
donatien | 5:dd63a1e02b1b | 77 | ///Executes a GET Request (blocking) |
donatien | 5:dd63a1e02b1b | 78 | /** |
donatien | 5:dd63a1e02b1b | 79 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 80 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 81 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 82 | Blocks until completion |
donatien | 5:dd63a1e02b1b | 83 | */ |
donatien | 0:632c9925f013 | 84 | HTTPResult get(const char* uri, HTTPData* pDataIn); //Blocking |
donatien | 5:dd63a1e02b1b | 85 | |
donatien | 5:dd63a1e02b1b | 86 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 87 | /** |
donatien | 5:dd63a1e02b1b | 88 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 89 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 90 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 91 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 92 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 93 | */ |
donatien | 0:632c9925f013 | 94 | HTTPResult get(const char* uri, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking |
donatien | 5:dd63a1e02b1b | 95 | |
donatien | 5:dd63a1e02b1b | 96 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 97 | /** |
donatien | 5:dd63a1e02b1b | 98 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 99 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 100 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 101 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 102 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 103 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 104 | */ |
donatien | 0:632c9925f013 | 105 | template<class T> |
donatien | 0:632c9925f013 | 106 | HTTPResult get(const char* uri, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking |
donatien | 0:632c9925f013 | 107 | { |
donatien | 0:632c9925f013 | 108 | setOnResult(pItem, pMethod); |
donatien | 0:632c9925f013 | 109 | doGet(uri, pDataIn); |
donatien | 0:632c9925f013 | 110 | return HTTP_PROCESSING; |
donatien | 0:632c9925f013 | 111 | } |
donatien | 0:632c9925f013 | 112 | |
donatien | 5:dd63a1e02b1b | 113 | ///Executes a POST Request (blocking) |
donatien | 5:dd63a1e02b1b | 114 | /** |
donatien | 5:dd63a1e02b1b | 115 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 116 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 117 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 118 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 119 | Blocks until completion |
donatien | 5:dd63a1e02b1b | 120 | */ |
donatien | 0:632c9925f013 | 121 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); //Blocking |
donatien | 5:dd63a1e02b1b | 122 | |
donatien | 5:dd63a1e02b1b | 123 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 124 | /** |
donatien | 5:dd63a1e02b1b | 125 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 126 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 127 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 128 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 129 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 130 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 131 | */ |
donatien | 0:632c9925f013 | 132 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking |
donatien | 5:dd63a1e02b1b | 133 | |
donatien | 5:dd63a1e02b1b | 134 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 135 | /** |
donatien | 5:dd63a1e02b1b | 136 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 137 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 138 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 139 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 140 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 141 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 142 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 143 | */ |
donatien | 0:632c9925f013 | 144 | template<class T> |
donatien | 0:632c9925f013 | 145 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking |
donatien | 0:632c9925f013 | 146 | { |
donatien | 0:632c9925f013 | 147 | setOnResult(pItem, pMethod); |
donatien | 0:632c9925f013 | 148 | doPost(uri, dataOut, pDataIn); |
donatien | 0:632c9925f013 | 149 | return HTTP_PROCESSING; |
donatien | 0:632c9925f013 | 150 | } |
donatien | 5:dd63a1e02b1b | 151 | |
donatien | 5:dd63a1e02b1b | 152 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 153 | /** |
donatien | 5:dd63a1e02b1b | 154 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 155 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 156 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 157 | The function returns immediately and calls the previously set callback on completion or error |
donatien | 5:dd63a1e02b1b | 158 | */ |
donatien | 5:dd63a1e02b1b | 159 | void doGet(const char* uri, HTTPData* pDataIn); |
donatien | 0:632c9925f013 | 160 | |
donatien | 5:dd63a1e02b1b | 161 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 162 | /** |
donatien | 5:dd63a1e02b1b | 163 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 164 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 165 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 166 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 167 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 168 | The function returns immediately and calls the previously set callback on completion or error |
donatien | 5:dd63a1e02b1b | 169 | */ |
donatien | 0:632c9925f013 | 170 | void doPost(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); |
donatien | 0:632c9925f013 | 171 | |
donatien | 5:dd63a1e02b1b | 172 | ///Setups the result callback |
donatien | 5:dd63a1e02b1b | 173 | /** |
donatien | 5:dd63a1e02b1b | 174 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 175 | */ |
donatien | 0:632c9925f013 | 176 | void setOnResult( void (*pMethod)(HTTPResult) ); |
donatien | 5:dd63a1e02b1b | 177 | |
donatien | 5:dd63a1e02b1b | 178 | ///Setups the result callback |
donatien | 5:dd63a1e02b1b | 179 | /** |
donatien | 5:dd63a1e02b1b | 180 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 181 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 182 | */ |
donatien | 0:632c9925f013 | 183 | class CDummy; |
donatien | 0:632c9925f013 | 184 | template<class T> |
donatien | 0:632c9925f013 | 185 | void setOnResult( T* pItem, void (T::*pMethod)(HTTPResult) ) |
donatien | 0:632c9925f013 | 186 | { |
donatien | 0:632c9925f013 | 187 | m_pCb = NULL; |
donatien | 0:632c9925f013 | 188 | m_pCbItem = (CDummy*) pItem; |
donatien | 0:632c9925f013 | 189 | m_pCbMeth = (void (CDummy::*)(HTTPResult)) pMethod; |
donatien | 0:632c9925f013 | 190 | } |
donatien | 5:dd63a1e02b1b | 191 | |
donatien | 5:dd63a1e02b1b | 192 | ///Setups timeout |
donatien | 5:dd63a1e02b1b | 193 | /** |
donatien | 5:dd63a1e02b1b | 194 | @param ms : time of connection inactivity in ms after which the request should timeout |
donatien | 5:dd63a1e02b1b | 195 | */ |
donatien | 0:632c9925f013 | 196 | void setTimeout(int ms); |
donatien | 0:632c9925f013 | 197 | |
donatien | 0:632c9925f013 | 198 | virtual void poll(); //Called by NetServices |
donatien | 0:632c9925f013 | 199 | |
donatien | 5:dd63a1e02b1b | 200 | ///Gets last request's HTTP response code |
donatien | 5:dd63a1e02b1b | 201 | /** |
donatien | 5:dd63a1e02b1b | 202 | @return The HTTP response code of the last request |
donatien | 5:dd63a1e02b1b | 203 | */ |
donatien | 0:632c9925f013 | 204 | int getHTTPResponseCode(); |
donatien | 5:dd63a1e02b1b | 205 | |
donatien | 5:dd63a1e02b1b | 206 | ///Sets a specific request header |
donatien | 0:632c9925f013 | 207 | void setRequestHeader(const string& header, const string& value); |
donatien | 5:dd63a1e02b1b | 208 | |
donatien | 5:dd63a1e02b1b | 209 | ///Gets a response header |
donatien | 0:632c9925f013 | 210 | string& getResponseHeader(const string& header); |
donatien | 5:dd63a1e02b1b | 211 | |
donatien | 5:dd63a1e02b1b | 212 | ///Clears request headers |
donatien | 0:632c9925f013 | 213 | void resetRequestHeaders(); |
donatien | 0:632c9925f013 | 214 | |
donatien | 0:632c9925f013 | 215 | protected: |
donatien | 0:632c9925f013 | 216 | void resetTimeout(); |
donatien | 0:632c9925f013 | 217 | |
donatien | 0:632c9925f013 | 218 | void init(); |
donatien | 0:632c9925f013 | 219 | void close(); |
donatien | 0:632c9925f013 | 220 | |
donatien | 0:632c9925f013 | 221 | void setup(const char* uri, HTTPData* pDataOut, HTTPData* pDataIn); //Setup request, make DNS Req if necessary |
donatien | 0:632c9925f013 | 222 | void connect(); //Start Connection |
donatien | 0:632c9925f013 | 223 | |
donatien | 0:632c9925f013 | 224 | int tryRead(); //Read data and try to feed output |
donatien | 0:632c9925f013 | 225 | void readData(); //Data has been read |
donatien | 0:632c9925f013 | 226 | void writeData(); //Data has been written & buf is free |
donatien | 0:632c9925f013 | 227 | |
donatien | 0:632c9925f013 | 228 | void onTCPSocketEvent(TCPSocketEvent e); |
donatien | 0:632c9925f013 | 229 | void onDNSReply(DNSReply r); |
donatien | 0:632c9925f013 | 230 | void onResult(HTTPResult r); //Called when exchange completed or on failure |
donatien | 0:632c9925f013 | 231 | void onTimeout(); //Connection has timed out |
donatien | 0:632c9925f013 | 232 | |
donatien | 0:632c9925f013 | 233 | private: |
donatien | 0:632c9925f013 | 234 | HTTPResult blockingProcess(); //Called in blocking mode, calls Net::poll() until return code is available |
donatien | 0:632c9925f013 | 235 | |
donatien | 0:632c9925f013 | 236 | bool readHeaders(); //Called first when receiving data |
donatien | 0:632c9925f013 | 237 | bool writeHeaders(); //Called to create req |
donatien | 0:632c9925f013 | 238 | int readLine(char* str, int maxLen, bool* pIncomplete = NULL); |
donatien | 0:632c9925f013 | 239 | |
donatien | 0:632c9925f013 | 240 | enum HTTP_METH |
donatien | 0:632c9925f013 | 241 | { |
donatien | 0:632c9925f013 | 242 | HTTP_GET, |
donatien | 0:632c9925f013 | 243 | HTTP_POST, |
donatien | 0:632c9925f013 | 244 | HTTP_HEAD |
donatien | 0:632c9925f013 | 245 | }; |
donatien | 0:632c9925f013 | 246 | |
donatien | 0:632c9925f013 | 247 | HTTP_METH m_meth; |
donatien | 0:632c9925f013 | 248 | |
donatien | 0:632c9925f013 | 249 | CDummy* m_pCbItem; |
donatien | 0:632c9925f013 | 250 | void (CDummy::*m_pCbMeth)(HTTPResult); |
donatien | 0:632c9925f013 | 251 | |
donatien | 0:632c9925f013 | 252 | void (*m_pCb)(HTTPResult); |
donatien | 0:632c9925f013 | 253 | |
donatien | 0:632c9925f013 | 254 | TCPSocket* m_pTCPSocket; |
donatien | 0:632c9925f013 | 255 | map<string, string> m_reqHeaders; |
donatien | 0:632c9925f013 | 256 | map<string, string> m_respHeaders; |
donatien | 0:632c9925f013 | 257 | |
donatien | 0:632c9925f013 | 258 | Timer m_watchdog; |
donatien | 0:632c9925f013 | 259 | int m_timeout; |
donatien | 0:632c9925f013 | 260 | |
donatien | 0:632c9925f013 | 261 | DNSRequest* m_pDnsReq; |
donatien | 0:632c9925f013 | 262 | |
donatien | 0:632c9925f013 | 263 | Host m_server; |
donatien | 0:632c9925f013 | 264 | string m_path; |
donatien | 0:632c9925f013 | 265 | |
donatien | 0:632c9925f013 | 266 | bool m_closed; |
donatien | 0:632c9925f013 | 267 | |
donatien | 0:632c9925f013 | 268 | enum HTTPStep |
donatien | 0:632c9925f013 | 269 | { |
donatien | 0:632c9925f013 | 270 | // HTTP_INIT, |
donatien | 0:632c9925f013 | 271 | HTTP_WRITE_HEADERS, |
donatien | 0:632c9925f013 | 272 | HTTP_WRITE_DATA, |
donatien | 0:632c9925f013 | 273 | HTTP_READ_HEADERS, |
donatien | 0:632c9925f013 | 274 | HTTP_READ_DATA, |
donatien | 0:632c9925f013 | 275 | HTTP_READ_DATA_INCOMPLETE, |
donatien | 0:632c9925f013 | 276 | HTTP_DONE, |
donatien | 0:632c9925f013 | 277 | HTTP_CLOSED |
donatien | 0:632c9925f013 | 278 | }; |
donatien | 0:632c9925f013 | 279 | |
donatien | 0:632c9925f013 | 280 | HTTPStep m_state; |
donatien | 0:632c9925f013 | 281 | |
donatien | 0:632c9925f013 | 282 | HTTPData* m_pDataOut; |
donatien | 0:632c9925f013 | 283 | HTTPData* m_pDataIn; |
donatien | 0:632c9925f013 | 284 | |
donatien | 0:632c9925f013 | 285 | bool m_dataChunked; //Data is encoded as chunks |
donatien | 0:632c9925f013 | 286 | int m_dataPos; //Position in data |
donatien | 0:632c9925f013 | 287 | int m_dataLen; //Data length |
donatien | 0:632c9925f013 | 288 | char* m_buf; |
donatien | 0:632c9925f013 | 289 | char* m_pBufRemaining; //Remaining |
donatien | 0:632c9925f013 | 290 | int m_bufRemainingLen; //Data length in m_pBufRemaining |
donatien | 0:632c9925f013 | 291 | |
donatien | 0:632c9925f013 | 292 | int m_httpResponseCode; |
donatien | 0:632c9925f013 | 293 | |
donatien | 0:632c9925f013 | 294 | HTTPResult m_blockingResult; //Result if blocking mode |
donatien | 0:632c9925f013 | 295 | |
donatien | 0:632c9925f013 | 296 | }; |
donatien | 0:632c9925f013 | 297 | |
donatien | 0:632c9925f013 | 298 | //Including data containers here for more convenience |
donatien | 0:632c9925f013 | 299 | #include "data/HTTPFile.h" |
donatien | 0:632c9925f013 | 300 | #include "data/HTTPStream.h" |
donatien | 0:632c9925f013 | 301 | #include "data/HTTPText.h" |
donatien | 0:632c9925f013 | 302 | #include "data/HTTPMap.h" |
donatien | 0:632c9925f013 | 303 | |
donatien | 0:632c9925f013 | 304 | #endif |