Hi everyone,
the attached set of patches against current darcs fixes the issue of parsing
headers in compact form inside a multipart payload. I've also tried to
include some tests in test_msg.c, but don't know if they're enough.
Thanks
--- libsofia-sip-ua/msg/Makefile.am.old 2009-03-04 10:24:18.000000000 -0300
+++ libsofia-sip-ua/msg/Makefile.am 2009-03-04 09:38:59.000000000 -0300
@@ -99,7 +99,7 @@
test_table.c: ${srcdir}/test_table.c.in
$(AWK_MSG_AWK) module=msg_test prefix=msg \
- MC_HASH_SIZE=127 multipart=msg_multipart \
+ MC_HASH_SIZE=127 MC_SHORT_SIZE=26 multipart=msg_multipart \
PT=$@ TEMPLATE=${srcdir}/test_table.c.in ${TEST_CLASS_H}
SS_MIME_H = ${srcdir}/sofia-sip/msg_mime.h
--- libsofia-sip-ua/msg/sofia-sip/msg_mime.h.old 2009-03-04 10:20:33.000000000 -0300
+++ libsofia-sip-ua/msg/sofia-sip/msg_mime.h 2009-03-04 08:36:24.000000000 -0300
@@ -168,13 +168,13 @@
msg_error_t *mp_error;
/* === Headers start here */
- msg_content_type_t *mp_content_type; /**< Content-Type */
+ msg_content_type_t *mp_content_type; /**< Content-Type (c) */
msg_content_disposition_t *mp_content_disposition;
/**< Content-Disposition */
msg_content_location_t *mp_content_location; /**< Content-Location */
msg_content_id_t *mp_content_id; /**< Content-ID */
msg_content_language_t *mp_content_language; /**< Content-Language */
- msg_content_encoding_t *mp_content_encoding; /**< Content-Encoding */
+ msg_content_encoding_t *mp_content_encoding; /**< Content-Encoding (e) */
msg_content_transfer_encoding_t *mp_content_transfer_encoding;
/**< Content-Transfer-Encoding */
#if 0
@@ -186,7 +186,7 @@
msg_accept_language_t *mp_accept_language; /**< Accept-Language */
msg_mime_version_t *mp_mime_version; /**< MIME-Version */
msg_content_md5_t *mp_content_md5; /**< Content-MD5 */
- msg_content_length_t *mp_content_length; /**< Content-Length */
+ msg_content_length_t *mp_content_length; /**< Content-Length (l) */
msg_multipart_t *mp_multipart; /**< Recursive multipart */
msg_warning_t *mp_warning; /**< Warning */
#endif
--- libsofia-sip-ua/msg/test_class.h.old 2009-03-04 10:24:34.000000000 -0300
+++ libsofia-sip-ua/msg/test_class.h 2009-03-04 09:43:09.000000000 -0300
@@ -95,7 +95,7 @@
msg_status_t *msg_status;
/* === Headers start here */
- msg_content_type_t *msg_content_type; /**< Content-Type */
+ msg_content_type_t *msg_content_type; /**< Content-Type (c) */
msg_content_disposition_t *msg_content_disposition;
/**< Content-Disposition */
msg_content_location_t *msg_content_location; /**< Content-Location */
@@ -108,8 +108,8 @@
msg_mime_version_t *msg_mime_version; /**< MIME-Version */
msg_content_md5_t *msg_content_md5; /**< Content-MD5 */
msg_content_encoding_t *msg_content_encoding;
- /**< Content-Encoding */
- msg_content_length_t *msg_content_length; /**< Content-Length */
+ /**< Content-Encoding (e) */
+ msg_content_length_t *msg_content_length; /**< Content-Length (l) */
msg_auth_t *msg_auth; /**< Auth (testing) */
msg_numeric_t *msg_numeric; /**< Numeric (testing) */
--- libsofia-sip-ua/msg/test_msg.c.old 2009-03-04 10:24:48.000000000 -0300
+++ libsofia-sip-ua/msg/test_msg.c 2009-03-04 10:13:25.000000000 -0300
@@ -1684,6 +1684,43 @@
END();
}
+/* Test parsing of compact headers */
+int test_compact_headers(void)
+{
+ msg_t *msg;
+ su_home_t *home;
+ msg_test_t *tst;
+
+ BEGIN();
+
+ msg = read_msg("GET a-life HTTP/1.1" CRLF
+ "l: 34" CRLF
+ "c: text/html" CRLF
+ "e: identity" CRLF
+ "Foo: bar" CRLF
+ "Accept-Encoding: z1, z2" CRLF
+ CRLF
+ "<html><body>part 3</body></html>" CRLF);
+
+ home = msg_home(msg);
+ tst = msg_test_public(msg);
+
+ TEST_1(msg);
+ TEST_1(home);
+ TEST_1(tst);
+
+ TEST_P(tst->msg_error, NULL);
+
+ /* Test that headers in compact form were correctly parsed */
+ TEST_1(tst->msg_content_length);
+ TEST_1(tst->msg_content_type);
+ TEST_1(tst->msg_content_encoding);
+
+ msg_destroy(msg);
+
+ END();
+}
+
static int random_test(void)
{
struct { uint64_t low, mid, hi; } seed = { 0, 0, 0 };
@@ -1749,6 +1786,7 @@
retval |= test_mime(); fflush(stdout);
retval |= test_mime2(); fflush(stdout);
retval |= test_serialize(); fflush(stdout);
+ retval |= test_compact_headers(); fflush(stdout);
return retval;
}
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel