[asterisk-commits] murf: branch group/http_mods r59990 - in /team/group/http_mods/main/minimime:...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Apr 3 13:20:50 MST 2007


Author: murf
Date: Tue Apr  3 15:20:50 2007
New Revision: 59990

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59990
Log:
fixed a few problems; but the BIG one is that the mm_mimeheader struct doesn't have a param list in it, and I suspect the API doesn't have anything for that either.

Modified:
    team/group/http_mods/main/minimime/mimeparser.y
    team/group/http_mods/main/minimime/mm.h
    team/group/http_mods/main/minimime/mytest_files/mytest.c

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=59990&r1=59989&r2=59990
==============================================================================
--- team/group/http_mods/main/minimime/mimeparser.y (original)
+++ team/group/http_mods/main/minimime/mimeparser.y Tue Apr  3 15:20:50 2007
@@ -47,6 +47,7 @@
 #include "mm.h"
 #include "mm_internal.h"
 
+int set_boundary(char *);
 extern int lineno;
 extern int condition;
 
@@ -309,11 +310,13 @@
 	CONTENTDISPOSITION_HEADER COLON content_disposition EOL
 	{
 		dprintf2("Content-Disposition -> %s\n", $3);
+		current_mimepart->disposition_type = xstrdup($3);
 	}
 	|
 	CONTENTDISPOSITION_HEADER COLON content_disposition content_disposition_parameters EOL
 	{
-		dprintf2("Content-Disposition (P) -> %s\n", $3);
+		dprintf2("Content-Disposition (P) -> %s; params\n", $3);
+		current_mimepart->disposition_type = xstrdup($3);
 	}
 	;
 
@@ -443,19 +446,22 @@
 content_disposition_parameter:
 	WORD EQUAL contenttype_parameter_value
 	{
-		if (!strcasecmp($3, "filename") 
+		if (!strcasecmp($1, "filename") 
 		    && current_mimepart->filename == NULL) {
 			current_mimepart->filename = xstrdup($3);
-		} else if (!strcasecmp($3, "creation-date")
+		} else if (!strcasecmp($1, "name")
+		    && current_mimepart->the_name == NULL) {
+			current_mimepart->the_name = xstrdup($3);
+		} else if (!strcasecmp($1, "creation-date")
 		    && current_mimepart->creation_date == NULL) {
 			current_mimepart->creation_date = xstrdup($3);
-		} else if (!strcasecmp($3, "modification-date")
+		} else if (!strcasecmp($1, "modification-date")
 		    && current_mimepart->modification_date == NULL) {
 			current_mimepart->modification_date = xstrdup($3);
-		} else if (!strcasecmp($3, "read-date")
+		} else if (!strcasecmp($1, "read-date")
 		    && current_mimepart->read_date == NULL) {
 		    	current_mimepart->read_date = xstrdup($3);
-		} else if (!strcasecmp($3, "size")
+		} else if (!strcasecmp($1, "size")
 		    && current_mimepart->disposition_size == NULL) {
 		    	current_mimepart->disposition_size = xstrdup($3);
 		} else {
@@ -474,11 +480,13 @@
 contenttype_parameter_value:
 	WORD
 	{
+		dprintf2("contenttype_param_val: WORD=%s\n", $1);
 		$$ = $1;
 	}
 	|
 	TSPECIAL
 	{
+		dprintf2("contenttype_param_val: TSPECIAL\n");
 		/* For broken MIME implementation */
 		if (parsemode != MM_PARSE_LOOSE) {
 			mm_errno = MM_ERROR_MIME;
@@ -493,6 +501,7 @@
 	|
 	'"' TSPECIAL '"'
 	{
+		dprintf2("contenttype_param_val: \"TSPECIAL\"\n" );
 		$$ = $2;
 	}
 	;
@@ -558,6 +567,8 @@
 		}	
 		current_mimepart->opaque_body = body;
 		current_mimepart->body = body + offset;
+		current_mimepart->opaque_length = strlen(body);
+		current_mimepart->length = current_mimepart->opaque_length - offset;
 	}
 	;
 

Modified: team/group/http_mods/main/minimime/mm.h
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/minimime/mm.h?view=diff&rev=59990&r1=59989&r2=59990
==============================================================================
--- team/group/http_mods/main/minimime/mm.h (original)
+++ team/group/http_mods/main/minimime/mm.h Tue Apr  3 15:20:50 2007
@@ -224,6 +224,7 @@
 
 	struct mm_content *type;
 
+	char *the_name;
 	char *disposition_type;
 	char *filename;
 	char *creation_date;

Modified: team/group/http_mods/main/minimime/mytest_files/mytest.c
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/minimime/mytest_files/mytest.c?view=diff&rev=59990&r1=59989&r2=59990
==============================================================================
--- team/group/http_mods/main/minimime/mytest_files/mytest.c (original)
+++ team/group/http_mods/main/minimime/mytest_files/mytest.c Tue Apr  3 15:20:50 2007
@@ -46,6 +46,11 @@
 	else
 		printf("FAILURE: Could not get the Content-Disposition header value!\n");
 
+	/* hmmm... strange, headers don't have params, which is really quite not-nice! */
+	/* but the author has been storing Content-Disposition params in the part structure */
+
+	printf("Interesting: the mimepart name is %s\n", part->the_name);
+
 	res = mm_mimepart_getlength(part);
 	if (res)
 		printf("SUCCESS: Got a non-zero value for the body length: %d\n", res);



More information about the asterisk-commits mailing list