Finally, I found the culprit!
At libevhtp's htparse.c:200, there are some compiler macros defined to do string comparisons:
#define _str3_cmp(m, c0, c1, c2, c3) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
#define _str3Ocmp(m, c0, c1, c2, c3) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
#define _str4cmp(m, c0, c1, c2, c3) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
#define _str5cmp(m, c0, c1, c2, c3, c4) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& m[4] == c4
#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& (((uint32_t *)m)[1] & 0xffff) == ((c5 << 8) | c4)
#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
This does not work for some reason, I could see during a debugging session that the function does not find the match when it should:
[...]
(gdb) n
490 switch (p->state) {
(gdb) n
544 if (ch == ' ') {
(gdb) n
545 char * m = p->buf;
(gdb) n
547 switch (p->buf_idx) {
(gdb) p m
$12 = 0xa86084 "OPTIONS"
(gdb) n
616 if (_str7_cmp(m, 'O', 'P', 'T', 'I', 'O', 'N', 'S', '\0')) {
(gdb) n
620 if (_str7_cmp(m, 'C', 'O', 'N', 'N', 'E', 'C', 'T', '\0')) {
Taking a closer look at the issue, I suddenly realized that the platform I'm compiling for is big-endian by default and the comparison functions are utilizing bitshift operators...
So, I just need to patch the code to do the comparison with respect to endianness and then it should work as expected.
Jeez, this was such a hard nut to crack! 
(Last edited by geryhun on 9 Dec 2014, 01:54)