Christian Grothoff 18 yıl önce
ebeveyn
işleme
aa8fb24fef
3 değiştirilmiş dosya ile 14 ekleme ve 6 silme
  1. 1 0
      AUTHORS
  2. 3 0
      ChangeLog
  3. 10 6
      src/daemon/postprocessor.c

+ 1 - 0
AUTHORS

@@ -7,6 +7,7 @@ Elliot Glaysher
 Daniel Pittman <[email protected]>
 Nils Durner <[email protected]>
 Heikki Lindholm <[email protected]>
+Alex Sadovsky <[email protected]>
 
 Documentation contributions also came from:
 Marco Maggi <[email protected]>

+ 3 - 0
ChangeLog

@@ -1,3 +1,6 @@
+Wed Jan  2 16:41:05 MST 2008
+	 Improvements and bugfixes to post processor implementation. - AS
+
 Wed Dec 19 21:12:04 MST 2007
 	 Implemented chunked (HTTP 1.1) downloads (including
 	 sending of HTTP footers).  Also allowed queuing of

+ 10 - 6
src/daemon/postprocessor.c

@@ -323,10 +323,14 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
 static int
 try_match_header (const char *prefix, char *line, char **suffix)
 {
-  if (0 == strncasecmp (prefix, line, strlen (prefix)))
+  while(*line != 0)
     {
-      *suffix = strdup (&line[strlen (prefix)]);
-      return MHD_YES;
+    if (0 == strncasecmp (prefix, line, strlen (prefix)))
+      {
+        *suffix = strdup (&line[strlen (prefix)]);
+        return MHD_YES;
+      }
+    ++line;
     }
   return MHD_NO;
 }
@@ -467,7 +471,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
                 endquote++;
               pp->content_disposition[endquote++] = '\0';       /* remove end-quote */
               if ((MHD_YES
-                   == try_match_header (" filename=",
+                   == try_match_header (" filename=\"",
                                         &pp->content_disposition[endquote],
                                         &pp->filename)) &&
                   (pp->filename != NULL) && (0 < strlen (pp->filename)))
@@ -525,6 +529,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
                   ioff += newline;
                   memmove (buf, &buf[ioff], pp->buffer_pos - ioff);
                   pp->buffer_pos -= ioff;
+                  ioff = 0;
                   break;
                 }
               if (newline + blen + 4 < pp->buffer_pos)
@@ -576,8 +581,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
                   newline += 4;
                   continue;
                 }
-
-
+              goto END;
             }
           break;
         case PP_FinalDash: