in src/uhttp.c [135:174]
static int process_status_code_line(const unsigned char* buffer, size_t len, size_t* position, int* statusLen)
{
int result = MU_FAILURE;
size_t index;
int spaceFound = 0;
const char* initSpace = NULL;
char status_code[4] = { 0 };
for (index = 0; index < len; index++)
{
if (buffer[index] == ' ')
{
if (spaceFound == 1)
{
(void)memcpy(status_code, initSpace, 3);
status_code[3] = '\0';
}
else
{
initSpace = (const char*)buffer + index + 1;
}
spaceFound++;
}
else if (buffer[index] == '\n')
{
*statusLen = (int)atol(status_code);
if (index < len)
{
*position = index + 1;
}
else
{
*position = index;
}
result = 0;
break;
}
}
return result;
}