diff options
-rw-r--r-- | src/misc.c | 2 | ||||
-rw-r--r-- | test/unit/Makefile.am | 1 | ||||
-rw-r--r-- | test/unit/disposition.c | 68 |
3 files changed, 65 insertions, 6 deletions
@@ -407,7 +407,7 @@ void a_Misc_parse_content_disposition(const char *disposition, char **type, char } } - const char invalid_characters[] = "/\\|"; + const char invalid_characters[] = "/\\|~"; for (char *s = *filename; s < *filename + len; s++) { if (strchr(invalid_characters, *s)) { *s = '_'; diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index b372a1ae..224ea5ba 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -36,6 +36,7 @@ disposition_SOURCES = \ disposition.c disposition_LDADD = \ $(top_builddir)/dlib/libDlib.a +disposition_CFLAGS = -flto notsosimplevector_SOURCES = notsosimplevector.cc identity_SOURCES = identity.cc identity_LDADD = \ diff --git a/test/unit/disposition.c b/test/unit/disposition.c index a2f5fc46..c49a541f 100644 --- a/test/unit/disposition.c +++ b/test/unit/disposition.c @@ -29,17 +29,75 @@ struct testcase { }; struct testcase cases[] = { - /* See http://test.greenbytes.de/tech/tc2231/ */ - { "attachment; filename=\"\\\"quoting\\\" tested.html\"", "attachment", "_\"quoting_\" tested.html" }, - //{ "attachment; filename=\"\\\"quoting\\\" tested.html\"", "attachment", "quoting" }, /* <-- Should be this */ - { "attachment; filename=\"/foo.html\"", "attachment", "_foo.html" }, { "attachment; filename=/foo", "attachment", "_foo" }, { "attachment; filename=./../foo", "attachment", "_.._foo" }, { "attachment; filename=", "attachment", NULL }, { "attachment; filename= ", "attachment", NULL }, { "attachment; filename=\"", "attachment", NULL }, { "attachment; filename=\"foo", "attachment", NULL }, - { "attachment; filename=~/foo", "attachment", "~_foo" }, + { "attachment; filename=~/foo", "attachment", "__foo" }, + + /* See http://test.greenbytes.de/tech/tc2231/ */ + { "inline", "inline", NULL }, + // FIXME: { "\"inline\"", NULL, NULL }, + { "inline; filename=\"foo.html\"", "inline", "foo.html" }, + { "inline; filename=\"Not an attachment!\"", "inline", "Not an attachment!" }, + { "inline; filename=\"foo.pdf\"", "inline", "foo.pdf" }, + // FIXME: { "\"attachment\"", NULL, NULL }, + { "attachment", "attachment", NULL }, + { "ATTACHMENT", "ATTACHMENT", NULL }, + { "attachment; filename=\"foo.html\"", "attachment", "foo.html" }, + { "attachment; filename=\"0000000000111111111122222\"", "attachment", "0000000000111111111122222" }, + { "attachment; filename=\"00000000001111111111222222222233333\"", "attachment", "00000000001111111111222222222233333" }, + { "attachment; filename=\"f\\oo.html\"", "attachment", "f_oo.html" }, + // FIXME: { "attachment; filename=\"\\\"quoting\\\" tested.html\"", "attachment", "\"quoting\" tested.html" }, + { "attachment; filename=\"Here's a semicolon;.html\"", "attachment", "Here's a semicolon;.html" }, + { "attachment; foo=\"bar\"; filename=\"foo.html\"", "attachment", "foo.html" }, + { "attachment; foo=\"\\\"\\\\\";filename=\"foo.html\"", "attachment", "foo.html" }, + { "attachment; FILENAME=\"foo.html\"", "attachment", "foo.html" }, + { "attachment; filename=foo.html", "attachment", "foo.html" }, + { "attachment; filename=foo,bar.html", "attachment", "foo,bar.html" }, + { "attachment; filename=foo.html ;", "attachment", "foo.html" }, + { "attachment; ;filename=foo", "attachment", "foo" }, + { "attachment; filename=foo bar.html", "attachment", "foo" }, + { "attachment; filename='foo.bar'", "attachment", "'foo.bar'" }, + { "attachment; filename=\"foo-ä.html\"", "attachment", "foo-ä.html" }, + { "attachment; filename=\"foo-ä.html\"", "attachment", "foo-ä.html" }, + { "attachment; filename=\"foo-%41.html\"", "attachment", "foo-%41.html" }, + { "attachment; filename=\"50%.html\"", "attachment", "50%.html" }, + { "attachment; filename=\"foo-%\\41.html\"", "attachment", "foo-%_41.html" }, + { "attachment; name=\"foo-%41.html\"", "attachment", NULL }, + { "attachment; filename=\"ä-%41.html\"", "attachment", "ä-%41.html" }, + { "attachment; filename=\"foo-%c3%a4-%e2%82%ac.html\"", "attachment", "foo-%c3%a4-%e2%82%ac.html" }, + { "attachment; filename =\"foo.html\"", "attachment", "foo.html" }, + { "attachment; filename=\"foo.html\"; filename=\"bar.html\"", "attachment", "foo.html" }, + { "attachment; filename=foo[1](2).html", "attachment", "foo[1](2).html" }, + // FIXME: { "attachment; filename=foo-ä.html", "attachment", NULL }, + // FIXME: { "attachment; filename=filename=foo-ä.html", "attachment", NULL }, + // FIXME: { "filename=foo.html", NULL, NULL }, + // FIXME: { "x=y; filename=foo.html", NULL, NULL }, + // FIXME: {"\"foo; filename=bar;baz\"; filename=qux", NULL, NULL }, + // FIXME: { "filename=foo.html, filename=bar.html", NULL, NULL }, + // FIXME: { "; filename=foo.html", NULL, NULL }, + // FIXME: { ": inline; attachment; filename=foo.html", NULL, NULL }, + // FIXME: { "inline; attachment; filename=foo.html", NULL, NULL }, + { "attachment; inline; filename=foo.html", "attachment", "foo.html" }, + { "attachment; filename=\"foo.html\".txt", "attachment", "foo.html" }, + { "attachment; filename=\"bar", "attachment", NULL }, + { "attachment; filename=foo\"bar;baz\"qux", "attachment", "foo\"bar" }, + { "attachment; filename=foo.html, attachment; filename=bar.html", "attachment", "foo.html," }, + { "attachment; foo=foo filename=bar", "attachment", "bar" }, + { "attachment; filename=bar foo=foo ", "attachment", "bar" }, + { "attachment filename=bar", "attachment", NULL }, + // FIXME: { "filename=foo.html; attachment", NULL, NULL }, + { "attachment; xfilename=foo.html", "attachment", NULL }, + { "attachment; filename=\"/foo.html\"", "attachment", "_foo.html" }, + { "attachment; filename=\"\\\\foo.html\"", "attachment", "__foo.html" }, + { "foobar", "foobar", NULL }, + { "attachment; example=\"filename=example.txt\"", "attachment", NULL }, + { "attachment; filename=\"foo-ae.html\"; filename*=UTF-8''foo-%c3%a4.html", "attachment", "foo-ae.html" }, + // FIXME: { "attachment; filename==?ISO-8859-1?Q?foo-=E4.html?=", "attachment", NULL }, + { "attachment; filename=\"=?ISO-8859-1?Q?foo-=E4.html?=\"", "attachment", "=?ISO-8859-1?Q?foo-=E4.html?=" }, }; static int equal(const char *a, const char *b) |