NetServices Stack source
Dependents: HelloWorld ServoInterfaceBoardExample1 4180_Lab4
services/http/client/HTTPClient.h@11:da4498f591ee, 2010-08-05 (annotated)
- Committer:
- donatien
- Date:
- Thu Aug 05 15:01:33 2010 +0000
- Revision:
- 11:da4498f591ee
- Parent:
- 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 | 9:c79fa4034f5b | 33 | #include "core/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 | 9:c79fa4034f5b | 60 | #include "core/netservice.h" |
donatien | 9:c79fa4034f5b | 61 | |
donatien | 5:dd63a1e02b1b | 62 | ///A simple HTTP Client |
donatien | 5:dd63a1e02b1b | 63 | /** |
donatien | 5:dd63a1e02b1b | 64 | The HTTPClient is composed of: |
donatien | 5:dd63a1e02b1b | 65 | - The actual client (HTTPClient) |
donatien | 5:dd63a1e02b1b | 66 | - 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 | 67 | */ |
donatien | 0:632c9925f013 | 68 | class HTTPClient : protected NetService |
donatien | 0:632c9925f013 | 69 | { |
donatien | 0:632c9925f013 | 70 | public: |
donatien | 5:dd63a1e02b1b | 71 | ///Instantiates the HTTP client |
donatien | 0:632c9925f013 | 72 | HTTPClient(); |
donatien | 0:632c9925f013 | 73 | virtual ~HTTPClient(); |
donatien | 0:632c9925f013 | 74 | |
donatien | 5:dd63a1e02b1b | 75 | ///Provides a basic authentification feature (Base64 encoded username and password) |
donatien | 0:632c9925f013 | 76 | void basicAuth(const char* user, const char* password); //Basic Authentification |
donatien | 0:632c9925f013 | 77 | |
donatien | 0:632c9925f013 | 78 | //High Level setup functions |
donatien | 5:dd63a1e02b1b | 79 | ///Executes a GET Request (blocking) |
donatien | 5:dd63a1e02b1b | 80 | /** |
donatien | 5:dd63a1e02b1b | 81 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 82 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 83 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 84 | Blocks until completion |
donatien | 5:dd63a1e02b1b | 85 | */ |
donatien | 0:632c9925f013 | 86 | HTTPResult get(const char* uri, HTTPData* pDataIn); //Blocking |
donatien | 5:dd63a1e02b1b | 87 | |
donatien | 5:dd63a1e02b1b | 88 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 89 | /** |
donatien | 5:dd63a1e02b1b | 90 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 91 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 92 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 93 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 94 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 95 | */ |
donatien | 0:632c9925f013 | 96 | HTTPResult get(const char* uri, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking |
donatien | 5:dd63a1e02b1b | 97 | |
donatien | 5:dd63a1e02b1b | 98 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 99 | /** |
donatien | 5:dd63a1e02b1b | 100 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 101 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 102 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 103 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 104 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 105 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 106 | */ |
donatien | 0:632c9925f013 | 107 | template<class T> |
donatien | 0:632c9925f013 | 108 | HTTPResult get(const char* uri, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking |
donatien | 0:632c9925f013 | 109 | { |
donatien | 0:632c9925f013 | 110 | setOnResult(pItem, pMethod); |
donatien | 0:632c9925f013 | 111 | doGet(uri, pDataIn); |
donatien | 0:632c9925f013 | 112 | return HTTP_PROCESSING; |
donatien | 0:632c9925f013 | 113 | } |
donatien | 0:632c9925f013 | 114 | |
donatien | 5:dd63a1e02b1b | 115 | ///Executes a POST Request (blocking) |
donatien | 5:dd63a1e02b1b | 116 | /** |
donatien | 5:dd63a1e02b1b | 117 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 118 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 119 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 120 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 121 | Blocks until completion |
donatien | 5:dd63a1e02b1b | 122 | */ |
donatien | 0:632c9925f013 | 123 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); //Blocking |
donatien | 5:dd63a1e02b1b | 124 | |
donatien | 5:dd63a1e02b1b | 125 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 126 | /** |
donatien | 5:dd63a1e02b1b | 127 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 128 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 129 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 130 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 131 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 132 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 133 | */ |
donatien | 0:632c9925f013 | 134 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, void (*pMethod)(HTTPResult)); //Non blocking |
donatien | 5:dd63a1e02b1b | 135 | |
donatien | 5:dd63a1e02b1b | 136 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 137 | /** |
donatien | 5:dd63a1e02b1b | 138 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 139 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 140 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 141 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 142 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 143 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 144 | The function returns immediately and calls the callback on completion or error |
donatien | 5:dd63a1e02b1b | 145 | */ |
donatien | 0:632c9925f013 | 146 | template<class T> |
donatien | 0:632c9925f013 | 147 | HTTPResult post(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn, T* pItem, void (T::*pMethod)(HTTPResult)) //Non blocking |
donatien | 0:632c9925f013 | 148 | { |
donatien | 0:632c9925f013 | 149 | setOnResult(pItem, pMethod); |
donatien | 0:632c9925f013 | 150 | doPost(uri, dataOut, pDataIn); |
donatien | 0:632c9925f013 | 151 | return HTTP_PROCESSING; |
donatien | 0:632c9925f013 | 152 | } |
donatien | 5:dd63a1e02b1b | 153 | |
donatien | 5:dd63a1e02b1b | 154 | ///Executes a GET Request (non blocking) |
donatien | 5:dd63a1e02b1b | 155 | /** |
donatien | 5:dd63a1e02b1b | 156 | Executes a GET request on the URI uri |
donatien | 5:dd63a1e02b1b | 157 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 158 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 159 | The function returns immediately and calls the previously set callback on completion or error |
donatien | 5:dd63a1e02b1b | 160 | */ |
donatien | 5:dd63a1e02b1b | 161 | void doGet(const char* uri, HTTPData* pDataIn); |
donatien | 0:632c9925f013 | 162 | |
donatien | 5:dd63a1e02b1b | 163 | ///Executes a POST Request (non blocking) |
donatien | 5:dd63a1e02b1b | 164 | /** |
donatien | 5:dd63a1e02b1b | 165 | Executes a POST request on the URI uri |
donatien | 5:dd63a1e02b1b | 166 | @param uri : URI on which to execute the request |
donatien | 5:dd63a1e02b1b | 167 | @param dataOut : a HTTPData instance that contains the data that will be posted |
donatien | 5:dd63a1e02b1b | 168 | @param pDataIn : pointer to an HTTPData instance that will collect the data returned by the request, can be NULL |
donatien | 5:dd63a1e02b1b | 169 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 170 | The function returns immediately and calls the previously set callback on completion or error |
donatien | 5:dd63a1e02b1b | 171 | */ |
donatien | 0:632c9925f013 | 172 | void doPost(const char* uri, const HTTPData& dataOut, HTTPData* pDataIn); |
donatien | 0:632c9925f013 | 173 | |
donatien | 5:dd63a1e02b1b | 174 | ///Setups the result callback |
donatien | 5:dd63a1e02b1b | 175 | /** |
donatien | 5:dd63a1e02b1b | 176 | @param pMethod : callback function |
donatien | 5:dd63a1e02b1b | 177 | */ |
donatien | 0:632c9925f013 | 178 | void setOnResult( void (*pMethod)(HTTPResult) ); |
donatien | 5:dd63a1e02b1b | 179 | |
donatien | 5:dd63a1e02b1b | 180 | ///Setups the result callback |
donatien | 5:dd63a1e02b1b | 181 | /** |
donatien | 5:dd63a1e02b1b | 182 | @param pItem : instance of class on which to execute the callback method |
donatien | 5:dd63a1e02b1b | 183 | @param pMethod : callback method |
donatien | 5:dd63a1e02b1b | 184 | */ |
donatien | 0:632c9925f013 | 185 | class CDummy; |
donatien | 0:632c9925f013 | 186 | template<class T> |
donatien | 0:632c9925f013 | 187 | void setOnResult( T* pItem, void (T::*pMethod)(HTTPResult) ) |
donatien | 0:632c9925f013 | 188 | { |
donatien | 0:632c9925f013 | 189 | m_pCb = NULL; |
donatien | 0:632c9925f013 | 190 | m_pCbItem = (CDummy*) pItem; |
donatien | 0:632c9925f013 | 191 | m_pCbMeth = (void (CDummy::*)(HTTPResult)) pMethod; |
donatien | 0:632c9925f013 | 192 | } |
donatien | 5:dd63a1e02b1b | 193 | |
donatien | 5:dd63a1e02b1b | 194 | ///Setups timeout |
donatien | 5:dd63a1e02b1b | 195 | /** |
donatien | 5:dd63a1e02b1b | 196 | @param ms : time of connection inactivity in ms after which the request should timeout |
donatien | 5:dd63a1e02b1b | 197 | */ |
donatien | 0:632c9925f013 | 198 | void setTimeout(int ms); |
donatien | 0:632c9925f013 | 199 | |
donatien | 0:632c9925f013 | 200 | virtual void poll(); //Called by NetServices |
donatien | 0:632c9925f013 | 201 | |
donatien | 5:dd63a1e02b1b | 202 | ///Gets last request's HTTP response code |
donatien | 5:dd63a1e02b1b | 203 | /** |
donatien | 5:dd63a1e02b1b | 204 | @return The HTTP response code of the last request |
donatien | 5:dd63a1e02b1b | 205 | */ |
donatien | 0:632c9925f013 | 206 | int getHTTPResponseCode(); |
donatien | 5:dd63a1e02b1b | 207 | |
donatien | 5:dd63a1e02b1b | 208 | ///Sets a specific request header |
donatien | 0:632c9925f013 | 209 | void setRequestHeader(const string& header, const string& value); |
donatien | 5:dd63a1e02b1b | 210 | |
donatien | 5:dd63a1e02b1b | 211 | ///Gets a response header |
donatien | 0:632c9925f013 | 212 | string& getResponseHeader(const string& header); |
donatien | 5:dd63a1e02b1b | 213 | |
donatien | 5:dd63a1e02b1b | 214 | ///Clears request headers |
donatien | 0:632c9925f013 | 215 | void resetRequestHeaders(); |
donatien | 0:632c9925f013 | 216 | |
donatien | 0:632c9925f013 | 217 | protected: |
donatien | 0:632c9925f013 | 218 | void resetTimeout(); |
donatien | 0:632c9925f013 | 219 | |
donatien | 0:632c9925f013 | 220 | void init(); |
donatien | 0:632c9925f013 | 221 | void close(); |
donatien | 0:632c9925f013 | 222 | |
donatien | 0:632c9925f013 | 223 | void setup(const char* uri, HTTPData* pDataOut, HTTPData* pDataIn); //Setup request, make DNS Req if necessary |
donatien | 0:632c9925f013 | 224 | void connect(); //Start Connection |
donatien | 0:632c9925f013 | 225 | |
donatien | 0:632c9925f013 | 226 | int tryRead(); //Read data and try to feed output |
donatien | 0:632c9925f013 | 227 | void readData(); //Data has been read |
donatien | 0:632c9925f013 | 228 | void writeData(); //Data has been written & buf is free |
donatien | 0:632c9925f013 | 229 | |
donatien | 0:632c9925f013 | 230 | void onTCPSocketEvent(TCPSocketEvent e); |
donatien | 0:632c9925f013 | 231 | void onDNSReply(DNSReply r); |
donatien | 0:632c9925f013 | 232 | void onResult(HTTPResult r); //Called when exchange completed or on failure |
donatien | 0:632c9925f013 | 233 | void onTimeout(); //Connection has timed out |
donatien | 0:632c9925f013 | 234 | |
donatien | 0:632c9925f013 | 235 | private: |
donatien | 0:632c9925f013 | 236 | HTTPResult blockingProcess(); //Called in blocking mode, calls Net::poll() until return code is available |
donatien | 0:632c9925f013 | 237 | |
donatien | 0:632c9925f013 | 238 | bool readHeaders(); //Called first when receiving data |
donatien | 0:632c9925f013 | 239 | bool writeHeaders(); //Called to create req |
donatien | 0:632c9925f013 | 240 | int readLine(char* str, int maxLen, bool* pIncomplete = NULL); |
donatien | 0:632c9925f013 | 241 | |
donatien | 0:632c9925f013 | 242 | enum HTTP_METH |
donatien | 0:632c9925f013 | 243 | { |
donatien | 0:632c9925f013 | 244 | HTTP_GET, |
donatien | 0:632c9925f013 | 245 | HTTP_POST, |
donatien | 0:632c9925f013 | 246 | HTTP_HEAD |
donatien | 0:632c9925f013 | 247 | }; |
donatien | 0:632c9925f013 | 248 | |
donatien | 0:632c9925f013 | 249 | HTTP_METH m_meth; |
donatien | 0:632c9925f013 | 250 | |
donatien | 0:632c9925f013 | 251 | CDummy* m_pCbItem; |
donatien | 0:632c9925f013 | 252 | void (CDummy::*m_pCbMeth)(HTTPResult); |
donatien | 0:632c9925f013 | 253 | |
donatien | 0:632c9925f013 | 254 | void (*m_pCb)(HTTPResult); |
donatien | 0:632c9925f013 | 255 | |
donatien | 0:632c9925f013 | 256 | TCPSocket* m_pTCPSocket; |
donatien | 0:632c9925f013 | 257 | map<string, string> m_reqHeaders; |
donatien | 0:632c9925f013 | 258 | map<string, string> m_respHeaders; |
donatien | 0:632c9925f013 | 259 | |
donatien | 0:632c9925f013 | 260 | Timer m_watchdog; |
donatien | 0:632c9925f013 | 261 | int m_timeout; |
donatien | 0:632c9925f013 | 262 | |
donatien | 0:632c9925f013 | 263 | DNSRequest* m_pDnsReq; |
donatien | 0:632c9925f013 | 264 | |
donatien | 0:632c9925f013 | 265 | Host m_server; |
donatien | 0:632c9925f013 | 266 | string m_path; |
donatien | 0:632c9925f013 | 267 | |
donatien | 0:632c9925f013 | 268 | bool m_closed; |
donatien | 0:632c9925f013 | 269 | |
donatien | 0:632c9925f013 | 270 | enum HTTPStep |
donatien | 0:632c9925f013 | 271 | { |
donatien | 0:632c9925f013 | 272 | // HTTP_INIT, |
donatien | 0:632c9925f013 | 273 | HTTP_WRITE_HEADERS, |
donatien | 0:632c9925f013 | 274 | HTTP_WRITE_DATA, |
donatien | 0:632c9925f013 | 275 | HTTP_READ_HEADERS, |
donatien | 0:632c9925f013 | 276 | HTTP_READ_DATA, |
donatien | 0:632c9925f013 | 277 | HTTP_READ_DATA_INCOMPLETE, |
donatien | 0:632c9925f013 | 278 | HTTP_DONE, |
donatien | 0:632c9925f013 | 279 | HTTP_CLOSED |
donatien | 0:632c9925f013 | 280 | }; |
donatien | 0:632c9925f013 | 281 | |
donatien | 0:632c9925f013 | 282 | HTTPStep m_state; |
donatien | 0:632c9925f013 | 283 | |
donatien | 0:632c9925f013 | 284 | HTTPData* m_pDataOut; |
donatien | 0:632c9925f013 | 285 | HTTPData* m_pDataIn; |
donatien | 0:632c9925f013 | 286 | |
donatien | 0:632c9925f013 | 287 | bool m_dataChunked; //Data is encoded as chunks |
donatien | 0:632c9925f013 | 288 | int m_dataPos; //Position in data |
donatien | 0:632c9925f013 | 289 | int m_dataLen; //Data length |
donatien | 0:632c9925f013 | 290 | char* m_buf; |
donatien | 0:632c9925f013 | 291 | char* m_pBufRemaining; //Remaining |
donatien | 0:632c9925f013 | 292 | int m_bufRemainingLen; //Data length in m_pBufRemaining |
donatien | 0:632c9925f013 | 293 | |
donatien | 0:632c9925f013 | 294 | int m_httpResponseCode; |
donatien | 0:632c9925f013 | 295 | |
donatien | 0:632c9925f013 | 296 | HTTPResult m_blockingResult; //Result if blocking mode |
donatien | 0:632c9925f013 | 297 | |
donatien | 0:632c9925f013 | 298 | }; |
donatien | 0:632c9925f013 | 299 | |
donatien | 0:632c9925f013 | 300 | //Including data containers here for more convenience |
donatien | 0:632c9925f013 | 301 | #include "data/HTTPFile.h" |
donatien | 0:632c9925f013 | 302 | #include "data/HTTPStream.h" |
donatien | 0:632c9925f013 | 303 | #include "data/HTTPText.h" |
donatien | 0:632c9925f013 | 304 | #include "data/HTTPMap.h" |
donatien | 0:632c9925f013 | 305 | |
donatien | 0:632c9925f013 | 306 | #endif |