[svn-commits] russell: branch group/http_mods r59851 - in /team/group/http_mods/main/minimi...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Apr 3 08:39:46 MST 2007


Author: russell
Date: Tue Apr  3 10:39:45 2007
New Revision: 59851

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59851
Log:
add a test that demonstrates problems I am having

Added:
    team/group/http_mods/main/minimime/mytest_files/
    team/group/http_mods/main/minimime/mytest_files/ast_postdata   (with props)
    team/group/http_mods/main/minimime/mytest_files/mytest.c   (with props)
Modified:
    team/group/http_mods/main/minimime/Makefile

Modified: team/group/http_mods/main/minimime/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/minimime/Makefile?view=diff&rev=59851&r1=59850&r2=59851
==============================================================================
--- team/group/http_mods/main/minimime/Makefile (original)
+++ team/group/http_mods/main/minimime/Makefile Tue Apr  3 10:39:45 2007
@@ -67,6 +67,9 @@
 
 all: $(LIBNAME)
 
+mytest: all mytest_files/mytest.o
+	$(CC) $(LDFLAGS) -o $@ mytest_files/mytest.o $(ARNAME)
+
 depend: 
 	mkdep $(CFLAGS) $(SRCS)
 
@@ -117,3 +120,4 @@
 	rm -f ${ARNAME}
 	rm -f .depend
 	cd tests && make clean
+	rm -f mytest_files/mytest.o mytest

Added: team/group/http_mods/main/minimime/mytest_files/ast_postdata
URL: http://svn.digium.com/view/asterisk/team/group/http_mods/main/minimime/mytest_files/ast_postdata?view=auto&rev=59851
==============================================================================
--- team/group/http_mods/main/minimime/mytest_files/ast_postdata (added)
+++ team/group/http_mods/main/minimime/mytest_files/ast_postdata Tue Apr  3 10:39:45 2007
@@ -1,0 +1,38 @@
+MyHeader1: blah1
+MyHeader2: blah2
+MyHeader3: blah3
+MyHeader4: blah4
+Content-Type: multipart/form-data; boundary=---------------------------175757342718946221771693683144
+
+-----------------------------175757342718946221771693683144
+Content-Disposition: form-data; name="MAX_FILE_SIZE"
+
+30000
+-----------------------------175757342718946221771693683144
+Content-Disposition: form-data; name="userfile"; filename="BUGS"
+Content-Type: application/octet-stream
+
+Asterisk Bug Tracking Information
+=================================
+
+To learn about and report Asterisk bugs, please visit
+the official Asterisk Bug Tracker at:
+
+	http://bugs.digium.com
+
+For more information on using the bug tracker, or to
+learn how you can contribute by acting as a bug marshall
+please see:
+
+	http://www.asterisk.org/developers/bug-guidelines
+
+If you would like to submit a feature request, please
+resist the temptation to post it to the bug tracker.
+Feature requests should be posted to the asterisk-dev
+mailing list, located at:
+
+	http://lists.digium.com 
+
+Thank you!
+
+-----------------------------175757342718946221771693683144--

Propchange: team/group/http_mods/main/minimime/mytest_files/ast_postdata
------------------------------------------------------------------------------
    svn:eol-style = CRLF

Propchange: team/group/http_mods/main/minimime/mytest_files/ast_postdata
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/http_mods/main/minimime/mytest_files/ast_postdata
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=59851
==============================================================================
--- team/group/http_mods/main/minimime/mytest_files/mytest.c (added)
+++ team/group/http_mods/main/minimime/mytest_files/mytest.c Tue Apr  3 10:39:45 2007
@@ -1,0 +1,58 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mm.h"
+
+int main(int argc, char *argv[])
+{
+	const char *filename = "mytest_files/ast_postdata";
+	MM_CTX *ctx;
+	struct mm_mimepart *part;
+	int res = 0;
+	const char *disp;
+
+	mm_library_init();
+	mm_codec_registerdefaultcodecs();
+
+	if (!(ctx = mm_context_new())) {
+		printf("Failed to create MiniMIME context!\n");
+		exit(1);
+	}
+
+	res = mm_parse_file(ctx, filename, MM_PARSE_LOOSE, 0);
+	if (res == -1) {
+		printf("Error parsing file %s\n", filename);
+		goto cleanup;
+	}
+
+	res = mm_context_countparts(ctx);
+	if (res != 3) {
+		printf("This file should have 3 parts, but parser says %d\n", res);
+		res = -1;
+		goto cleanup;
+	}
+
+	/* Part 2 is the file */
+	if (!(part = mm_context_getpart(ctx, 2))) {
+		printf("Failed to get a reference to part 2 of the MIME data\n");
+		res = -1;
+		goto cleanup;
+	}
+
+	/* This is where the problems are demonstrated. */
+
+	if ((disp = mm_mimepart_getheadervalue(part, "Content-Disposition", 0)))
+		printf("SUCCESS: Got the Content-Disposition header: %s\n", disp);
+	else
+		printf("FAILURE: Could not get the Content-Disposition header value!\n");
+
+	res = mm_mimepart_getlength(part);
+	if (res)
+		printf("SUCCESS: Got a non-zero value for the body length: %d\n", res);
+	else
+		printf("FAILURE: The silly parser says this MIME part has 0 length!\n");
+
+cleanup:
+	mm_context_free(ctx);
+	exit(res);
+}

Propchange: team/group/http_mods/main/minimime/mytest_files/mytest.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/http_mods/main/minimime/mytest_files/mytest.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/http_mods/main/minimime/mytest_files/mytest.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain



More information about the svn-commits mailing list