Mladen Turk wrote:
Rainer Jung wrote:
But the header could be shorter than the constant string. So there was
a second problem with the old code, we eventually compared potentially
uninitialized memory to string constants. Strictly speaking the result
was not defined.
Sorry, but you get that wrong. At the beginning we have
size_t len = strlen(header_name);
Yes Mladen, I know. But we never really use len :) I know, that we can
do it with memcmp, but then you, me or someone else has to add a couple
of if(len>=...) before each memcmp(). Go ahead if you like to.
What I'm still convinced is, that the code before the patch was not
formally correct. I'm not saying, that strcmp is the best possible patch
with respect to performance. Concerning code structure I didn't try it
with adding all the ifs concerning len, so I can't yet judge.
So, we know in advance what the length is.
The double check with strcmp is overhead.
There is no double check, because before we actually doidn't check.
That's what I tried to explain: we do check when decoding HTTP method,
we do not check, when decoding header names. The patch concerns the
header names part.
Regards,
Mladen
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]