18 struct HttpParameterEntry {
19 HttpParameterEntry() =
default;
38 while (in.available() > 0) {
40 in.readBytesUntil(
'&', buffer,
max_len);
48 const char *key = buffer;
49 const char *value = buffer + pos + 1;
53 if (entry !=
nullptr) {
56 entry =
new HttpParameterEntry();
67 void parse(Stream &in,
void (*callback)(
const char *key,
const char *value)) {
69 while (in.available() > 0) {
71 in.readBytesUntil(
'&', buffer,
max_len);
79 const char *key = buffer;
80 const char *value = buffer + pos + 1;
89 if (entry->key.equals(key)) {
99 if (entry->key.equals(key)) {
109 if (entry->key.equals(key)) {
110 return entry->value.c_str();
119 if (entry->key.equals(key)) {
120 return entry->value.toFloat();
129 if (entry->key.equals(key)) {
130 return entry->value.toInt();
151 if ((*src ==
'%') && ((a = src[1]) && (b = src[2])) &&
152 (isxdigit(a) && isxdigit(b))) {
153 if (a >=
'a') a -=
'a' -
'A';
158 if (b >=
'a') b -=
'a' -
'A';
165 }
else if (*src ==
'+') {
API for http parameters: key=value&key1=value1.
Definition: HttpParameters.h:17
void parse(Stream &in, void(*callback)(const char *key, const char *value))
Definition: HttpParameters.h:67
~HttpParameters()
Destructor.
Definition: HttpParameters.h:33
HttpParameters(const int maxLen=256)
Default Constructor.
Definition: HttpParameters.h:30
bool hasKey(const char *key)
Checks if the parameter exists.
Definition: HttpParameters.h:87
void urldecode2(char *dst, const char *src)
Definition: HttpParameters.h:148
void clear()
Clears all values.
Definition: HttpParameters.h:137
int max_len
Definition: HttpParameters.h:146
int getInt(const char *key)
Returns the value for a parameter id as int.
Definition: HttpParameters.h:127
HttpParameterEntry * getParameter(const char *key)
Returns a HttpParameterEntry for a parameter id.
Definition: HttpParameters.h:97
Vector< HttpParameterEntry * > parameters
Definition: HttpParameters.h:145
void parse(Stream &in)
Parses the parameters in the client stream.
Definition: HttpParameters.h:36
float getFloat(const char *key)
Returns the value for a parameter id as float.
Definition: HttpParameters.h:117
const char * getValue(const char *key)
Returns the value for a parameter id as string.
Definition: HttpParameters.h:107
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: StrView.h:25
virtual int indexOf(const char c, int start=0)
Definition: StrView.h:267
String implementation which keeps the data on the heap. We grow the allocated memory only if the copy...
Definition: Str.h:22
void clear() override
clears the string by setting the terminating 0 at the beginning
Definition: Str.h:164
void clear()
Definition: Vector.h:161
void push_back(T &&value)
Definition: Vector.h:167
Definition: Allocator.h:6
@ DlnaDebug
Definition: Logger.h:16
@ DlnaInfo
Definition: Logger.h:16
LoggerClass DlnaLogger
Definition: Logger.cpp:5