MIME multipart message improperly terminated bug
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3414
Reported by Jeff Utter, funk@softhome.net
I'm using pike 7.4.21 with the Caudium web server. I've noticed a bug related to uploading files using MIME attachments. IT seems that small files work fine, however larger files do not. The web browser keeps saying it's loading, but the caudium log gives error ouput as follows:
multipart message improperly terminated ("\r\nContent-Disposition:
form-data; name=\"file\"; filename=\"drummer.png\"\r\nContent-Type:
image/png***Here it shows the text ouput of the file i cut it out to save
lots of space in the bug report*** )
/usr/local/pike/7.4.21/lib/modules/MIME.pmod/module.pmod:1078:
MIME.Message()->create("-----------------------------47449013511489176341833204461\r\nContent-Disposition:
form-data; name=\"file\"; filename=\"drummer.png\"\r\nContent-Type:
image/png\r\n\r\n\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\1g\0\0\1j\b\6\0"+[16854],mapping[11],0,0)
object_program(MIME): MIME->Message()
protocols/http.pike:200: protocols/http()->handle_body_encoding(21665)
protocols/http.pike:455: protocols/http()->parse_got()
protocols/http.pike:1657:
protocols/http()->got_data(0,"7\366$\336\31t\34\223\245\314)\262r\16\302\361D_\25\36PjZuk\27\7!\301""6\345D9s\224\277\7\341\317N|\24\215\255\234\233\220ES\355\273\274\36\361\310\310\373\354\350u\340-\334\23\212q\210\37\177=\322\216[9\367
\35\345<\31\231\350\254\t\274\215<
\343\234\261\307J\243(\347\t1\367\347\227V`\245\30\373\253\364\203nD\345\274#\372\33\322?\220\207\\n\177lU<\217\373\\\276A}+g\27q\377\336""5\345\274\21b\352*\323\216\230\275\216#\207o+Y\257\352\247\365e\335\25s\177YQiG\323L2\365ls\326r\253|I\261\24""3\300\177\225\355CS\225\"]4_\347\264"+[1254])
/usr/local/pike/7.4.21/lib/modules/Stdio.pmod/module.pmod:695:
Stdio.File("socket", "192.168.0.2 58269", 777 /* fd=19
*/)->__stdio_read_callback()
module.c:58()->Builtin()->Backend:
module.c:58()->Builtin()->__backend->`()(3600.000000)
/usr/local/pike/7.4.21/lib/master.pike:1951:
master()->_main(({"bin/caudium","-DCAUDIUM","-DCAUDIUM_CACHE","-DROXEN","-DMODULE_DEBUG","-w","-Mlib/7.4.21/",,,6}),({"SSH_CLIENT=192.168.0.2
63575 22","USER=root","MAIL=/var/mail/root","SHLVL=1",,,15}))
The log keeps repeating this until i press stop in my browser...
Here i'll include the code i use to upload the images.
HTML PAGE:
excerpt from Caudium Pike Module:
mixed find_file( string f, object id ) {
string sucpage = id->variables->success;
string fpage = id->variables->failed;
string contents = id->variables->file;
string filename = id->variables["file.filename"];
string gallery;
if (id->variables->gallery)
gallery = id->variables->gallery;
else
gallery = QUERY(defaultgallery);
string galpath = Stdio.append_path(QUERY(albumpath), gallery);
string path = Stdio.append_path(QUERY(albumpath), gallery, filename);
if ( contents && filename && Stdio.is_dir(galpath) &&
!Stdio.is_file(path) && isgood(filename) && sizeof(contents) <
QUERY(maxsize) ) {
Stdio.write_file ( path, contents );
return http_string_answer("Upload Succeeded","text/html");
}
I hope this helps someone locate and troubleshoot this bug, it's seriously stumping my productivity... Well thanks for any help.