- Timestamp:
- Nov 4, 2009 1:17:31 PM (15 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsip/sip_transport.h
r2932 r2985 386 386 pjsip_clen_hdr *clen; 387 387 388 /** The first Require header. */ 388 /** "Require" header containing aggregates of all Require 389 * headers found in the message, or NULL. 390 */ 389 391 pjsip_require_hdr *require; 392 393 /** "Supported" header containing aggregates of all Supported 394 * headers found in the message, or NULL. 395 */ 396 pjsip_supported_hdr *supported; 390 397 391 398 /** The list of error generated by the parser when parsing -
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r2695 r2985 1008 1008 hdr = (*handler)(ctx); 1009 1009 1010 /* Note: 1011 * hdr MAY BE NULL, if parsing does not yield a new header 1012 * instance, e.g. the values have been added to existing 1013 * header. See http://trac.pjsip.org/repos/ticket/940 1014 */ 1015 1010 1016 /* Check if we've just parsed a Content-Type header. 1011 1017 * We will check for a message body if we've got Content-Type 1012 1018 * header. 1013 1019 */ 1014 if (hdr ->type == PJSIP_H_CONTENT_TYPE) {1020 if (hdr && hdr->type == PJSIP_H_CONTENT_TYPE) { 1015 1021 ctype_hdr = (pjsip_ctype_hdr*)hdr; 1016 1022 } … … 1028 1034 * So here we must insert list instead of just insert one header. 1029 1035 */ 1030 pj_list_insert_nodes_before(&msg->hdr, hdr); 1036 if (hdr) 1037 pj_list_insert_nodes_before(&msg->hdr, hdr); 1031 1038 1032 1039 /* Parse until EOF or an empty line is found. */ … … 1640 1647 } 1641 1648 1642 pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE, &hdr->values[0]); 1649 if (hdr->count >= PJ_ARRAY_SIZE(hdr->values)) { 1650 /* Too many elements */ 1651 on_syntax_error(scanner); 1652 return; 1653 } 1654 1655 pj_scan_get( scanner, &pconst.pjsip_NOT_COMMA_OR_NEWLINE, 1656 &hdr->values[hdr->count]); 1643 1657 hdr->count++; 1644 1658 … … 1918 1932 static pjsip_hdr* parse_hdr_require( pjsip_parse_ctx *ctx ) 1919 1933 { 1920 pjsip_require_hdr *hdr = pjsip_require_hdr_create(ctx->pool); 1934 pjsip_require_hdr *hdr; 1935 pj_bool_t new_hdr = (ctx->rdata->msg_info.require == NULL); 1936 1937 if (ctx->rdata && ctx->rdata->msg_info.require) { 1938 hdr = ctx->rdata->msg_info.require; 1939 } else { 1940 hdr = pjsip_require_hdr_create(ctx->pool); 1941 ctx->rdata->msg_info.require = hdr; 1942 } 1943 1921 1944 parse_generic_array_hdr(hdr, ctx->scanner); 1922 1945 1923 if (ctx->rdata && ctx->rdata->msg_info.require == NULL) 1924 ctx->rdata->msg_info.require = hdr; 1925 1926 return (pjsip_hdr*)hdr; 1946 return new_hdr ? (pjsip_hdr*)hdr : NULL; 1927 1947 } 1928 1948 … … 1961 1981 static pjsip_hdr* parse_hdr_supported(pjsip_parse_ctx *ctx) 1962 1982 { 1963 pjsip_supported_hdr *hdr = pjsip_supported_hdr_create(ctx->pool); 1983 pjsip_supported_hdr *hdr; 1984 pj_bool_t new_hdr = (ctx->rdata->msg_info.supported == NULL); 1985 1986 if (ctx->rdata && ctx->rdata->msg_info.supported) { 1987 hdr = ctx->rdata->msg_info.supported; 1988 } else { 1989 hdr = pjsip_supported_hdr_create(ctx->pool); 1990 ctx->rdata->msg_info.supported = hdr; 1991 } 1992 1964 1993 parse_generic_array_hdr(hdr, ctx->scanner); 1965 return (pjsip_hdr*)hdr; 1966 } 1967 1994 return new_hdr ? (pjsip_hdr*)hdr : NULL; 1995 } 1968 1996 1969 1997 /* Parse To: header. */
Note: See TracChangeset
for help on using the changeset viewer.