Commit b5b12562 authored by Pekka Pessi's avatar Pekka Pessi

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.

darcs-hash:20090224133335-db55f-fc1a36df2d3c36236946a80cf671844967aff5e8.gz
parent 76d94555
......@@ -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) ||
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment