Commit 1a61a37d authored by Pekka Pessi's avatar Pekka Pessi

torture_sip.c: added more tests for refer-to.

darcs-hash:20061004122610-65a35-9cc966c752b60f9eb999a857f9b9105934741aa2.gz
parent e2e2c735
......@@ -1961,7 +1961,47 @@ int test_refer(void)
BEGIN();
char const m[] =
"REFER sip:10.3.3.104 SIP/2.0\r\n"
"Via: SIP/2.0/UDP 10.3.3.8;branch=z9hG4bKb8389b4c1BA8899\r\n"
"From: \"Anthony Minessale\" <sip:polycom500@10.3.3.104>;tag=5AA04E0-66CFC37F\r\n"
"To: <sip:3001@10.3.3.104>;user=phone;tag=j6Fg9y7t8KNrF\r\n"
"CSeq: 4 REFER\r\n"
"Call-ID: a14822a4-5932e3ea-d7f37191@10.3.3.8\r\n"
"Contact: <sip:polycom500@10.3.3.8>\r\n"
"User-Agent: PolycomSoundPointIP-SPIP_500-UA/1.4.1\r\n"
"Refer-To: <sip:2000@10.3.3.104?Replaces=7d84c014-321368da-efa90f41%40"
"10.3.3.8%3Bto-tag%3DpaNKgBB9vQe3D%3Bfrom-tag%3D93AC8D50-7CF6DAAF>\r\n"
"Referred-By: \"Anthony Minessale\" <sip:polycom500@10.3.3.104>\r\n"
"Max-Forwards: 70\r\n"
"Content-Length: 0\r\n"
"\r\n";
msg_t *msg;
msg_iovec_t *iovec;
isize_t veclen, i, size;
char *back;
TEST_1(home = su_home_create());
msg = read_message(0, m); TEST_1(msg);
TEST(msg_prepare(msg), strlen(m));
TEST_1(veclen = msg_iovec(msg, NULL, ISIZE_MAX));
TEST_1(iovec = su_zalloc(msg_home(home), veclen * (sizeof iovec[0])));
TEST(msg_iovec(msg, iovec, veclen), veclen);
for (i = 0, size = 0; i < veclen; i++)
size += iovec[i].mv_len;
TEST_1(back = su_zalloc(msg_home(msg), size + 1));
for (i = 0, size = 0; i < veclen; i++) {
memcpy(back + size, iovec[i].mv_base, iovec[i].mv_len);
size += iovec[i].mv_len;
}
back[size] = '\0';
TEST_S(back, m);
TEST_1(r = r0 = sip_refer_to_make(home, "http://example.com;foo=bar"));
TEST(r->r_url->url_type, url_http);
TEST_1(r->r_params);
......@@ -1995,6 +2035,17 @@ int test_refer(void)
TEST(r->r_params[1], NULL);
/* XXX */
{
char const s[] =
"<sip:2000@10.3.3.104?Replaces=7d84c014-321368da-efa90f41%4010.3.3.8"
"%3Bto-tag%3DpaNKgBB9vQe3D%3Bfrom-tag%3D93AC8D50-7CF6DAAF>";
char *str;
TEST_1(r = r0 = sip_refer_to_make(home, s));
msg_fragment_clear(r->r_common);
TEST_1(str = sip_header_as_string(home, (void *)r));
TEST_S(str, s);
}
su_home_destroy(home), su_free(NULL, home);
......
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