Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: exosite_http_example exosite_http_example
Fork of HTTPClient by
HTTPMap Class Reference
Map of key/value pairs Used to transmit POST data using the application/x-www-form-urlencoded encoding. More...
#include <HTTPMap.h>
Inherits IHTTPDataIn, and IHTTPDataOut.
Public Member Functions | |
HTTPMap () | |
Instantiates HTTPMap It supports at most 32 key/values pairs. | |
HTTPMap (char *buf, size_t size) | |
Create an HTTPMap instance for input. | |
void | put (const char *key, const char *value) |
Put Key/Value pair The references to the parameters must remain valid as long as the clear() function is not called. | |
bool | pop (char *&key, char *&value) |
Pop one Key/Value pair The returned refrences remain valid as long as the original buffer is not modified. | |
bool | get (const char *key, char *val_buf, const size_t max) |
Get Value specified in Key The value is copied into the provided buffer. | |
void | clear () |
Clear table. | |
Protected Member Functions | |
virtual void | readReset () |
Reset stream to its beginning Called by the HTTPClient on each new request. | |
virtual int | read (char *buf, size_t len, size_t *pReadLen) |
Read a piece of data to be transmitted. | |
virtual int | getDataType (char *type, size_t maxTypeLen) |
Get MIME type. | |
virtual bool | getIsChunked () |
Determine whether the HTTP client should chunk the data Used for Transfer-Encoding header. | |
virtual size_t | getDataLen () |
If the data is not chunked, get its size Used for Content-Length header. | |
virtual void | writeReset () |
Reset stream to its beginning Called by the HTTPClient on each new request. | |
virtual int | write (const char *buf, size_t len) |
Write a piece of data transmitted by the server. | |
virtual void | setDataType (const char *type) |
Set MIME type. | |
virtual void | setIsChunked (bool chunked) |
Determine whether the data is chunked Recovered from Transfer-Encoding header. | |
virtual void | setDataLen (size_t len) |
If the data is not chunked, set its size From Content-Length header. | |
Friends | |
class | HTTPClient |
class | HTTPClient |
Detailed Description
Map of key/value pairs Used to transmit POST data using the application/x-www-form-urlencoded encoding.
Definition at line 31 of file HTTPMap.h.
Constructor & Destructor Documentation
HTTPMap | ( | ) |
Instantiates HTTPMap It supports at most 32 key/values pairs.
Definition at line 37 of file HTTPMap.cpp.
HTTPMap | ( | char * | buf, |
size_t | size | ||
) |
Create an HTTPMap instance for input.
- Parameters:
-
str Buffer to store the incoming string size Size of the buffer
Definition at line 42 of file HTTPMap.cpp.
Member Function Documentation
void clear | ( | ) |
Clear table.
Definition at line 58 of file HTTPMap.cpp.
bool get | ( | const char * | key, |
char * | val_buf, | ||
const size_t | max | ||
) |
Get Value specified in Key The value is copied into the provided buffer.
- Parameters:
-
key The key of the value to get val_buf The output buffer into which the value will be copied max The size of the buffer len The number of bytes copied into the output buffer
Definition at line 279 of file HTTPMap.cpp.
size_t getDataLen | ( | ) | [protected, virtual] |
If the data is not chunked, get its size Used for Content-Length header.
Implements IHTTPDataOut.
Definition at line 162 of file HTTPMap.cpp.
int getDataType | ( | char * | type, |
size_t | maxTypeLen | ||
) | [protected, virtual] |
Get MIME type.
- Parameters:
-
type Internet media type from Content-Type header
Implements IHTTPDataOut.
Definition at line 150 of file HTTPMap.cpp.
bool getIsChunked | ( | ) | [protected, virtual] |
Determine whether the HTTP client should chunk the data Used for Transfer-Encoding header.
Implements IHTTPDataOut.
Definition at line 157 of file HTTPMap.cpp.
bool pop | ( | char *& | key, |
char *& | value | ||
) |
Pop one Key/Value pair The returned refrences remain valid as long as the original buffer is not modified.
- Parameters:
-
key The key value The corresponding value
Definition at line 245 of file HTTPMap.cpp.
void put | ( | const char * | key, |
const char * | value | ||
) |
Put Key/Value pair The references to the parameters must remain valid as long as the clear() function is not called.
- Parameters:
-
key The key to use value The corresponding value
Definition at line 47 of file HTTPMap.cpp.
int read | ( | char * | buf, |
size_t | len, | ||
size_t * | pReadLen | ||
) | [protected, virtual] |
Read a piece of data to be transmitted.
- Parameters:
-
buf Pointer to the buffer on which to copy the data len Length of the buffer pReadLen Pointer to the variable on which the actual copied data length will be stored
Implements IHTTPDataOut.
Definition at line 69 of file HTTPMap.cpp.
void readReset | ( | ) | [protected, virtual] |
Reset stream to its beginning Called by the HTTPClient on each new request.
Implements IHTTPDataOut.
Definition at line 64 of file HTTPMap.cpp.
void setDataLen | ( | size_t | len ) | [protected, virtual] |
If the data is not chunked, set its size From Content-Length header.
Implements IHTTPDataIn.
Definition at line 239 of file HTTPMap.cpp.
void setDataType | ( | const char * | type ) | [protected, virtual] |
Set MIME type.
- Parameters:
-
type Internet media type from Content-Type header
Implements IHTTPDataIn.
Definition at line 229 of file HTTPMap.cpp.
void setIsChunked | ( | bool | chunked ) | [protected, virtual] |
Determine whether the data is chunked Recovered from Transfer-Encoding header.
Implements IHTTPDataIn.
Definition at line 234 of file HTTPMap.cpp.
int write | ( | const char * | buf, |
size_t | len | ||
) | [protected, virtual] |
Write a piece of data transmitted by the server.
- Parameters:
-
buf Pointer to the buffer from which to copy the data len Length of the buffer
Implements IHTTPDataIn.
Definition at line 220 of file HTTPMap.cpp.
void writeReset | ( | ) | [protected, virtual] |
Reset stream to its beginning Called by the HTTPClient on each new request.
Implements IHTTPDataIn.
Definition at line 215 of file HTTPMap.cpp.
Generated on Fri Jul 15 2022 21:09:11 by
