void *content, char *cbtype, char *cbcharset,
size_t length, char *encoding, char *cbid, void *userdata)
{
- syslog(LOG_DEBUG, "upload_handler()");
- syslog(LOG_DEBUG, " name: %s", name);
- syslog(LOG_DEBUG, " filename: %s", filename);
- syslog(LOG_DEBUG, " part number: %s", partnum);
- syslog(LOG_DEBUG, " disposition: %s", disp);
- syslog(LOG_DEBUG, "content type: %s", cbtype);
- syslog(LOG_DEBUG, " char set: %s", cbcharset);
- syslog(LOG_DEBUG, " length: %ld", length);
- syslog(LOG_DEBUG, " encoding: %s", encoding);
- syslog(LOG_DEBUG, " id: %s", cbid);
-
struct uploaded_file u;
// create a random ID for the attachment
for (int i=0; i<array_len(upload_list); ++i) {
memcpy(&u, array_get_element_at(upload_list, i), sizeof(struct uploaded_file));
- syslog(LOG_DEBUG, "%d: %s %s", i, u.id, u.filename);
}
// Create a JSON object describing this upload
// Normally the browser will upload only one file per transaction, but that behavior is not guaranteed.
JsonValue *j_uploads = NewJsonArray(HKEY(""));
- // h->request_body will contain the upload(s) in MIME format
- mime_parser(h->request_body, (h->request_body + h->request_body_length), *upload_handler, NULL, NULL, j_uploads, 0);
+ // h->request_body_with_synth_headers will contain the upload(s) in MIME format including headers
+ mime_parser(h->request_body_with_synth_headers, (h->request_body+h->request_body_length), *upload_handler, NULL, NULL, j_uploads, 0);
// probably do something more clever here
h->response_code = 200;
h->response_string = strdup("OK");
h->response_body_length = StrLength(sj);
h->response_body = SmashStrBuf(&sj);
+ syslog(LOG_DEBUG, "upload: %s", h->response_body);
}