attachment functionality broken for mhttpd built-in elog

Issue #150 resolved
Thomas Lindner created an issue

People still using the built-in MIDAS elog have reported problems with posting messages with attachments. I can replicate this problem. Most elog messages work fine, but if you try to add an attachment you get error message

501 Not Implemented

I stepped back through older commits to MIDAS. I figured out that the bug was introduced in this commit

https://bitbucket.org/tmidas/midas/commits/045659bae951a6e00d93b5f5aeec62ee89ce1237

The commit message says that the commit was to fix handling cases with null length. I think this case of a post request with an attachment is getting incorrectly caught by this check:

if (msg->body.p && strlen(msg->body.p) < msg->body.len) {

I think that Stefan might be able to better fix this line, since he dealt with original problem. If he doesn't have time I will take a shot.

Comments (1)

  1. Thomas Lindner reporter

    Looked in more detail at the description of the original issue 129. The change that Stefan made to decode_post() seems to correctly catch null bytes in post data strings. But the extra check made in handle_http_message() seem to accidentally catch the case of post data being binary attachment files from build-in elog (which can contain null bytes).

    So I made a commit where I removed the extra check in handle_http_message, since it seemed to be only a back-up check. The committed code seems to restore the elog attachment functionality, while still preserving the null byte check for other post data.

  2. Log in to comment