[LIBC] Modfied Version of sscanf

Robert Schulze rs at bytecamp.net
Mon May 2 14:58:44 UTC 2011


Hi,

Am 02.05.2011 16:41, schrieb Artem Belevich:
>
>>         if(ptr&&  (ptr=strstr(ptr," HTTP/1.1"))) /* find end of res */
>
> Contrary to the comment in the code you're not checking for "HTTP/1.1"
> at the end but you're checking for it *anywhere* in the string. While
> it will occur at the end of valid input string, nobody said it can't
> occur in the middle, too. Original requirement was saying "surrounded
> by GET and HTTP/1.1".

good catch :-)
The additional test for end-of-string should be an exercise for the OP.
Reading the code of <your favourite webserver here> should clarify 
things, too.

With kind regards,
Robert Schulze



More information about the freebsd-hackers mailing list