L.S.,
In the current svn version, the PROPPATCH header is recognized as
PROPFIND, because the current code only matches the first four characters
on a 32bit architecture. On a 64bit architecture the code will always try
to match 8 characters, hence the problem with GET.
This is because the cmp_str macro in header.c uses the sizeof keyword.
sizeof is able to return the length of a hard-coded array, but not after
the addres of this array has been cast. Example:
int main() {
printf("%i\n", sizeof("test test"));
printf("%i\n", sizeof((const char *)"test test"));
}
The above code outputs the numbers 10 and 4 on a 32bit architecture, and
the numbers 10 and 8 on a 64bit architecture. In the stable Cherokee code
the cast was not present, but in the current svn trunk it is. Hence the
problem. The consequences are twofold:
* On 32bits architectures, any header starting with (e.g.) "PROP" will be
accepted.
* On 64bits architectures, header keyword such as GET will not be
recognized.
Proposed solutions:
1) Either, remove the const char * cast.
2) or, replace the sizeof keyword in the cmp_str macro with a call to
strlen(), and remove the '- 1'.
Both solutions work. It may be the case (we are not 100% sure) that the
first solution calculates the string length at compile time, and may hence
be a little faster.
Yours Sincerely,
Stefan de Konink
Stephan Schroevers
_______________________________________________
Cherokee mailing list
[email protected]
http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee