mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-12 02:45:48 +00:00
Respond to POSTs as well as GETs in /cm handler (#900)
* add method to parse args from body instead of just url * Allow /cm to POST and PUT as well as GET * forgot to ensure didn't misparse non GET/PUT/POST in /cm requests --------- Co-authored-by: Tim Connors <tconnors@rather.puzzling.org>
This commit is contained in:
@ -351,14 +351,9 @@ int http_copyCarg(const char* atin, char* to, int maxSize) {
|
||||
return realSize;
|
||||
}
|
||||
|
||||
int http_getArg(const char* base, const char* name, char* o, int maxSize) {
|
||||
int http_getRawArg(const char* base, const char* name, char* o, int maxSize) {
|
||||
*o = '\0';
|
||||
while (*base != '?') {
|
||||
if (*base == 0)
|
||||
return 0;
|
||||
base++;
|
||||
}
|
||||
base++;
|
||||
|
||||
while (*base) {
|
||||
const char* at = http_checkArg(base, name);
|
||||
if (at) {
|
||||
@ -375,6 +370,17 @@ int http_getArg(const char* base, const char* name, char* o, int maxSize) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int http_getArg(const char* base, const char* name, char* o, int maxSize) {
|
||||
*o = '\0';
|
||||
while (*base != '?') {
|
||||
if (*base == '\0')
|
||||
return 0;
|
||||
base++;
|
||||
}
|
||||
base++;
|
||||
|
||||
return http_getRawArg(base, name, o, maxSize);
|
||||
}
|
||||
int http_getArgInteger(const char* base, const char* name) {
|
||||
char tmp[16];
|
||||
if (http_getArg(base, name, tmp, sizeof(tmp)) == 0)
|
||||
|
||||
Reference in New Issue
Block a user