Hi all!
        I just discovered a mismatch between documentation and implementation
of the SSI support in the httpd application (version 2.0.3): The
documentation of tSSIHandler says

"The handler returns the number of characters written to pcInsert
excluding any terminating NULL or a negative number to indicate a
failure (tag not recognized, for example)."

        First of all, tSSIHandler is defined to return a u16_t, which is
unsigned and hence generates signed/unsigned warnings in case an error
is to be returned.
        Then, in httpd.c line 783, the return value of the SSI handler is
directly stored in tag_insert_len and in line 793 compared against
HTTPD_SSI_TAG_UNKNOWN. If this special value is set (defined as 0xffff
in httpd.h line 172), the httpd inserts an error message indicating that
the requested tag is not recognized, which overwrites tag_insert_len to
a value number. If the SSI handler returns any other values between
iInsertLen and HTTPD_SSI_TAG_UNKNOWN, I see all types of strange errors
including hardfaults (probably more related to my memory map) while
sending data and no indication that the SSI handler is the root cause.
        As a quick-fix I'd add an assertion in httpd.c just before the return
statement in line 796 to capture this problem. On long term one could
probably add an error message like "unknown tag" to inform the user.

        Jan

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to