Hi Marius, Thanks for the response.. I checked the other functions, but they don't have the check for ret !=end, but they check the pointer and if it is comma then loop through again until it find all the media types.
As per the RFC3261 multiple media-types are not supoorted in the Content-Type. So I'm not sure why the author used comma to determine multiple media types . Probably just followed like Route or Record-Route headers..?? Content-Type <http://rfc-ref.org/RFC-TEXTS/3261/kw-content_type.html> = ( "Content-Type <http://rfc-ref.org/RFC-TEXTS/3261/kw-content_type.html>" / "c" ) HCOLON media-type <http://rfc-ref.org/RFC-TEXTS/3261/kw-media-type.html> media-type <http://rfc-ref.org/RFC-TEXTS/3261/kw-media-type.html> = m-type SLASH m-subtype *(SEMI m-parameter) m-type = discrete-type / composite <http://rfc-ref.org/RFC-TEXTS/3261/kw-composite.html>-type discrete-type = "text" / "image <http://rfc-ref.org/RFC-TEXTS/3261/kw-image.html>" / "audio <http://rfc-ref.org/RFC-TEXTS/3261/kw-audio.html>" / "video" / "application" / extension-token <http://rfc-ref.org/RFC-TEXTS/3261/kw-token.html> composite <http://rfc-ref.org/RFC-TEXTS/3261/kw-composite.html>-type = "message" / "multipart" / extension-token <http://rfc-ref.org/RFC-TEXTS/3261/kw-token.html> Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route) Thanks Jijo On Thu, Aug 18, 2011 at 2:23 AM, Bucur Marius <bucur_marius_ovi...@yahoo.com > wrote: > Hello Jijo, > > It seems like the decode_mime_type is a somehow broken. The comma is very > well allowed in boundary, as you said. The BNF specified in RFC2046 permits > it. > But, the decode_mime_type function ignores everything coming after comma. > More than that, it notifies the function caller that this content type has > multiple mime types. > I think the author of the function thought of something like: > > Content-Type: text/html, image/jpeg // very weird, though > > This is wrong, hence the comma can be in a parameter (like in your case). > I think the best fix, as you said is to remove that check, hence a non-NULL > return value doesn't mean anything (that the content type has multiple mime > types). > Another fix is to write a "good" decode_mime_type, that checks if the comma > is inside a parameter. I don't know if effort is worth it. > > One thing we need to do is to check if there are any functions in Kamailio > that call decode_mime_type and also perform this check (ret != end). > > Cheers, > Marius > > > ________________________________ > From: Jijo <realj...@gmail.com> > To: sr-users@lists.sip-router.org; sr-...@lists.sip-router.org > Sent: Wednesday, August 17, 2011 10:54 AM > Subject: [SR-Users] decode_mime_type error > > > Hi All, > > The function parse_content_type_hdr() is failing in decode_mime_type() when > Content-Type parameter "boundary" has value comma as below. The error > message is "ERROR:parse_content_type_hdr: CONTENT_TYPE hdr contains " > "more then one mime type :-(! > > Content Type Header is as below, It works fine if the boundary value is > without comma. > > Content-Type: multipart/mixed;boundary=",AW" > > The parse_content_type_hdr() is failing in the following code, > > ret = decode_mime_type(msg->content_type->body.s, end , &mime); > if (ret==0) > goto error; > if (ret!=end) { > > LOG(L_INFO,"ERROR:parse_content_type_hdr: CONTENT_TYPE hdr > contains " > "more then one mime type :-(!\n"); > goto error ; > } > > I thought of fixing this issue by commenting the code for condition ret > !=end. I'm not sure why we we need that check, as mime variable has the > information to process the content. > > Please let me know if you see any impact. > > Thanks > Jijo > > > > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users