Commit 0cb1829c authored by baire's avatar baire
Browse files

try to match the CRLF before the header name in MessageHeader so that the...

try to match the CRLF before the header name in MessageHeader so that the mismatch error message is more meaningful
parent 0f9eeb4f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1199,8 +1199,12 @@ void MessageHeader::PreDecodeField (Buffer& buffer) throw (DecodeError)
	static Regex reg_header_name ("^(" SIPREG_HNAME ")" SIPREG_HCOLON);
	static Regex reg_crlf ("^\r\n");

	if (reg_header_name.Match (buffer))
	{
	if (reg_crlf.Match (buffer)) {
		reg_crlf.MovePast (buffer);
		SetHypNextField (-2); // end of the headers
	} else {
		reg_header_name.AssertMatch (buffer, this);

		const SipHeaderMap::Entry& hdr = SipHeaderMap::GetByName(reg_header_name.GetMatchedString (1));
		int id = hdr.mIdMessageHeader;

@@ -1253,10 +1257,6 @@ void MessageHeader::PreDecodeField (Buffer& buffer) throw (DecodeError)
			}
		}
		SetHypNextField (id);
	} else {
		reg_crlf.AssertMatch (buffer, this);
		reg_crlf.MovePast (buffer);
		SetHypNextField (-2); // end of the headers
	}
}