From a603728a26fcc593a57b421229b7575e29716ea4 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 13 Dec 2023 17:25:43 -0500 Subject: [PATCH] uploads.c: made the syslog less verbose Also documented the JSON return values in api.txt --- webcit-ng/api.txt | 9 +++++++++ webcit-ng/server/upload.c | 16 +--------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/webcit-ng/api.txt b/webcit-ng/api.txt index 35de78ef3..f148f53c5 100644 --- a/webcit-ng/api.txt +++ b/webcit-ng/api.txt @@ -35,5 +35,14 @@ GET /ctdl/u//userpic Returns an image containing t GET /ctdl/s/ Static content (html, css, js, images...) GET /.well-known/ Static content (RFC5785 compliant paths) POST /ctdl/p Handler for uploading attachments and other file items + The JSON returned wil contain one or more uploads in an array like this: + [ + { + "uploadfilename" : "Track 01.wav", + "contenttype" : "audio/wav", + "ref" : "cdarzowkk", + "contentlength" : 56222252 + } + ] GET /ctdl/p/ Fetch a specific item that was uploaded DELETE /ctdl/p/ Delete a specific item that was uploaded diff --git a/webcit-ng/server/upload.c b/webcit-ng/server/upload.c index 8c3fd44e0..6854acf8a 100644 --- a/webcit-ng/server/upload.c +++ b/webcit-ng/server/upload.c @@ -16,20 +16,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, 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); - //fprintf(stderr, "\033[31m--------------------------------------------\n"); - //write(content, length, 1, stderr); // FIXME - //printf(stderr, "--------------------------------------------\033[0m\n"); - struct uploaded_file u; // create a random ID for the attachment @@ -65,7 +51,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, for (int i=0; iresponse_string = strdup("OK"); h->response_body_length = StrLength(sj); h->response_body = SmashStrBuf(&sj); + syslog(LOG_DEBUG, "upload: %s", h->response_body); } -- 2.30.2