fix(http_loop): correctly parse content-type

lsm
Jef Roosens 2023-11-14 20:34:01 +01:00
parent f97de2fe83
commit 13b20715bf
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 13 additions and 1 deletions

View File

@ -4,6 +4,18 @@
#include "http_loop.h" #include "http_loop.h"
#include "lander.h" #include "lander.h"
// Just a naive pow implementation; might improve later
static uint64_t ipow(uint64_t base, uint64_t power) {
uint64_t res = 1;
while (power > 0) {
res *= base;
power--;
}
return res;
}
/* /*
* Converts a string to a number, returning true if the string contained a valid * Converts a string to a number, returning true if the string contained a valid
* positive number. * positive number.
@ -18,7 +30,7 @@ static bool string_to_num(size_t *res, const char *s, size_t len) {
return false; return false;
} }
*res += val * (int)pow(10, (len - 1) - i); *res += (uint64_t)val * ipow(10, (len - 1) - i);
} }
return true; return true;