[En-Nut-Discussion] Failed HTTP request
Harald Kipp
harald.kipp at egnite.de
Thu Apr 21 11:25:10 CEST 2011
Hi Nathan,
On 4/20/2011 7:36 PM, Nathan Moore wrote:
> Another thought is if you can use realloc to resize the buffer if you
> don't have a full
> line in it -- implementing a getline function, if you don't already have one.
At least there is none in nut/crt, but if no one else is faster, I'll
add it, together with getdelim().
Although useful, they may not fit well here. What if a malformed request
sends thousands of bytes? getline() will not stop until all memory is
consumed.
One idea is to start with fgetc(). If it turns out after a few
characters, that our server is not interested in this specific header,
I'd like to discard the entire line, calling a new function fskipl() and
avoiding this senseless buffer transfer.
For targets with enough memory, we may optionally include "unexpected
headers" in an extended REQUEST structure.
Regards,
Harald
More information about the En-Nut-Discussion
mailing list