From 1d2559d349b537a47670a30cf55b484872ff540a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 30 May 2001 01:06:57 +0000 Subject: [PATCH] * Changes to mime parser ... still something wrong --- webcit/ChangeLog | 4 +++- webcit/mime_parser.c | 11 ++++++----- webcit/webcit.c | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 98f2da669..df478c028 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 213.18 2001/05/30 01:06:57 ajc +* Changes to mime parser ... still something wrong + Revision 213.17 2001/05/28 19:27:29 ajc * Fixed bug which marked all messages in Lobby as old before reading at login @@ -559,4 +562,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/mime_parser.c b/webcit/mime_parser.c index d197c5cac..69873ef14 100644 --- a/webcit/mime_parser.c +++ b/webcit/mime_parser.c @@ -314,8 +314,8 @@ void the_mime_parser(char *partnum, strcpy(header, ""); do { ptr = memreadline(ptr, buf, sizeof buf); - if (*ptr == 0) - return; /* premature end of message */ + /* if (*ptr == 0) + return; premature end of message */ if (content_end != NULL) if (ptr >= content_end) return; @@ -408,7 +408,7 @@ void the_mime_parser(char *partnum, } part_start = ptr; } - } while ( (strcasecmp(buf, endary)) && (ptr != 0) ); + } while ( (strcasecmp(buf, endary)) && (ptr <= content_end) ); END_MULTI: if (PostMultiPartCallBack != NULL) { PostMultiPartCallBack("", "", partnum, "", NULL, content_type, 0, encoding, userdata); @@ -418,10 +418,11 @@ END_MULTI: if (PostMultiPartCallBack != NULL) { /* If it's not a multipart message, then do something with it */ if (!is_multipart) { + fprintf(stderr, "doing non-multipart thing\n"); part_start = ptr; length = 0; - while ((*ptr != 0) - && ((content_end == NULL) || (ptr < content_end))) { + while ( ( (*ptr != 0) && (content_end != NULL) ) + || (ptr < content_end) ) { ++length; part_end = ptr++; } diff --git a/webcit/webcit.c b/webcit/webcit.c index 0f06876bc..6cb40a0cf 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -601,6 +601,7 @@ void session_loop(struct httprequest *req) struct httprequest *hptr; char browser_host[256]; char user_agent[256]; + FILE *fp; /* We stuff these with the values coming from the client cookies, * so we can use them to reconnect a timed out session if we have to. @@ -665,6 +666,9 @@ void session_loop(struct httprequest *req) "application/x-www-form-urlencoded", 33)) { addurls(content); } else if (!strncasecmp(ContentType, "multipart", 9)) { + fp = fopen("mime.out", "wb"); + fwrite(content, ContentLength, 1, fp); + fclose(fp); content_end = content + ContentLength; mime_parser(content, content_end, *upload_handler, NULL, NULL, NULL, 0); -- 2.39.2