From f2a92f3b3808d154b880bdc3909485b0cb91348f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 25 May 2008 15:03:51 +0000 Subject: [PATCH] Tue May 20 09:33:08 EDT 2008 Pekka.Pessi@nokia.com * torture_sip.c: added test for Content-Type git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8616 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/sip/torture_sip.c | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index dd6ed5177e..4b12818ccd 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Sun May 25 10:58:52 EDT 2008 +Sun May 25 11:03:45 EDT 2008 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c b/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c index e826982f9c..a3b2b8e6d9 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c @@ -2227,7 +2227,6 @@ static int test_accept(void) static int test_content_disposition(void) { - /* Test Accept header */ sip_content_disposition_t *cd, *cd0; su_home_t *home; @@ -2247,6 +2246,38 @@ static int test_content_disposition(void) END(); } + +static int test_content_type(void) +{ + sip_content_type_t *c; + sip_content_type_t c0[1]; + su_home_t *home; + + BEGIN(); + + TEST_1(home = su_home_create()); + TEST_1(c = sip_content_type_make(home, "application/sdp ; charset = utf-8")); + TEST_S(c->c_type, "application/sdp"); + TEST_S(c->c_subtype, "sdp"); + TEST_1(c->c_params && c->c_params[0] && !c->c_params[1]); + TEST_S(c->c_params[0], "charset=utf-8"); + TEST_P(c->c_params[1], NULL); + + sip_content_type_init(c0); + c = sip_content_type_dup(home, c0); + TEST_P(c->c_type, NULL); + TEST_P(c->c_subtype, NULL); + + c0->c_type = "text"; + c = sip_content_type_dup(home, c0); + TEST_S(c->c_type, "text"); + TEST_P(c->c_subtype, NULL); + + su_home_unref(home); + END(); +} + + static int test_www_authenticate(void) { sip_www_authenticate_t *www; @@ -3570,6 +3601,7 @@ int main(int argc, char *argv[]) retval |= test_refer(); fflush(stdout); retval |= test_route(); fflush(stdout); retval |= test_request_disposition(); fflush(stdout); + retval |= test_content_type(); fflush(stdout); retval |= test_caller_prefs(); fflush(stdout); retval |= test_callerpref_scoring(); fflush(stdout); retval |= test_warning(); fflush(stdout);