[svn-commits] russell: branch group/http_mods r60009 - in /team/group/http_mods/main: ./ mi...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Apr 3 15:00:37 MST 2007


Author: russell
Date: Tue Apr  3 17:00:37 2007
New Revision: 60009

URL: http://svn.digium.com/view/asterisk?view=rev&rev=60009
Log:
Now the parser stores the filename, use that instead of finding it manually.
Also, comment out some code in the parser that causes crashes the second time
you use it.

Modified:
    team/group/http_mods/main/http.c
    team/group/http_mods/main/minimime/mimeparser.y

Modified: team/group/http_mods/main/http.c
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/http.c?view=diff&rev=60009&r1=60008&r2=60009
==============================================================================
--- team/group/http_mods/main/http.c (original)
+++ team/group/http_mods/main/http.c Tue Apr  3 17:00:37 2007
@@ -354,41 +354,10 @@
 
 static int get_filename(struct mm_mimepart *part, char *fn, size_t fn_len)
 {
-	char disp[1024] = "";
-	char *tmp, *filename;
-
-	if (get_mimepart_header(part, "Content-Disposition:", disp, sizeof(disp))) {
-		ast_log(LOG_DEBUG, "No Content-Disposition header\n");
+	if (ast_strlen_zero(part->filename))
 		return -1;
-	}
-
-#if 0
-	/* This doesn't work ... :( */
-	if (!(disp = mm_mimepart_getheadervalue(part, "Content-Disposition", 0))) {
-		ast_log(LOG_DEBUG, "No Content-Disposition header\n");
-		return -1;
-	}
-#endif
-
-	filename = ast_strdupa(disp);
-	if (!(filename = strcasestr(filename, "filename"))) {
-		ast_log(LOG_DEBUG, "No filename found in the disposition header\n");
-		return -1;
-	}
-
-	strsep(&filename, "=");
-	if (ast_strlen_zero(filename))
-		return -1;
-
-	strsep(&filename, "\"");
-	if (ast_strlen_zero(filename))
-		return -1;
-
-	tmp = filename;
-	strsep(&tmp, "\"");
-
-	ast_log(LOG_DEBUG, "The filename for this part is %s\n", filename);
-	ast_copy_string(fn, filename, fn_len);
+
+	ast_copy_string(fn, part->filename, fn_len);
 
 	return 0;
 }
@@ -503,8 +472,6 @@
 			ast_log(LOG_DEBUG, "Failed to get mime part num %d\n", i);
 			continue;
 		}
-
-		ast_log(LOG_DEBUG, "Body of Part %d: %s\n", i, mm_mimepart_getbody(part, 0));
 
 		if (get_filename(part, fn, sizeof(fn)))
 			continue;

Modified: team/group/http_mods/main/minimime/mimeparser.y
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/minimime/mimeparser.y?view=diff&rev=60009&r1=60008&r2=60009
==============================================================================
--- team/group/http_mods/main/minimime/mimeparser.y (original)
+++ team/group/http_mods/main/minimime/mimeparser.y Tue Apr  3 17:00:37 2007
@@ -739,6 +739,7 @@
 int
 PARSER_initialize(MM_CTX *newctx, int mode)
 {
+#if 0
 	if (ctx != NULL) {
 		xfree(ctx);
 		ctx = NULL;
@@ -751,6 +752,7 @@
 		xfree(ctype);
 		ctype = NULL;
 	}	
+#endif
 
 	ctx = newctx;
 	parsemode = mode;



More information about the svn-commits mailing list