]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Tue Feb 24 07:33:35 CST 2009 Pekka Pessi <first.last@nokia.com>
authorBrian West <brian@freeswitch.org>
Tue, 24 Feb 2009 14:46:03 +0000 (14:46 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 24 Feb 2009 14:46:03 +0000 (14:46 +0000)
  * sip_parser.c: fixed sip_transport_d()
  Ignore-this: c14408145a269c25d00dcb20ab2391f6

  sip_transport_d() was expected to canonize casing of well-known transports.

  Thanks for Adrian Gschwend for reporting the problem.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12261 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/sip/sip_parser.c
libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c

index 00f62a4bd17d40cd147630dadf9a9adc807cc59e..d2f7835f44fd652a9bf6add3396511ad4275d27b 100644 (file)
@@ -1 +1 @@
-Tue Feb 24 08:43:18 CST 2009
+Tue Feb 24 08:44:37 CST 2009
index de0fd055d7a305d1ac645b46000dc2615bb96dab..2982df537d73c1610400ed7eeff8086d18a54826 100644 (file)
@@ -459,8 +459,9 @@ issize_t sip_transport_d(char **ss, char const **ttransport)
   size_t pn_len, pv_len, pt_len;
   char *s = *ss;
 
-#define TRANSPORT_MATCH(t)                                          \
-  (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && (IS_LWS(s[sizeof(t)])) \
+#define TRANSPORT_MATCH(t) \
+  (su_casenmatch(s + 7, t + 7, (sizeof t) - 8) && \
+   (!s[sizeof(t) - 1] || IS_LWS(s[sizeof(t) - 1]))     \
    && (transport = t, s += sizeof(t) - 1))
 
   if (!su_casenmatch(s, "SIP/2.0", 7) ||
index 7c79310dd77d681a8ec0ccf998dfc9bda2526d53..2927380728d3e40c9057d513700560a9e02b26ab 100644 (file)
@@ -710,6 +710,31 @@ int test_basic(void)
     su_free(home, v), su_free(home, s);
   }
 
+  {
+    char *input;
+    char const *output = NULL;
+    char udp[] = "sip/2.0/udp";
+    char tcp[] = "sip/2.0/tCp ";
+    char sctp[] = "sip/2.0/sctp\t";
+    char tls[] = "sip/2.0/tls\r";
+
+    input = udp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/UDP");
+
+    input = tcp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/TCP");
+
+    input = sctp;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/SCTP");
+
+    input = tls;
+    TEST(sip_transport_d(&input, &output), 0);
+    TEST_S(output, "SIP/2.0/TLS");
+  }
+
   {
     sip_expires_t *ex;
 
@@ -2323,7 +2348,7 @@ static int test_www_authenticate(void)
   TEST_S(www->au_scheme, "Kerberos");
   TEST_1(www = www->au_next);
   TEST_S(www->au_scheme, "NTLM");
-  
   msg_destroy(msg);
 
   END();