Code Monkey home page Code Monkey logo

Comments (9)

negbie avatar negbie commented on June 19, 2024

I throw addHdr err: no semi found in: %s" whenever there is no ":" the header line. At this point in code I expect following:

headername: headervalue

As you can see here:
https://github.com/negbie/sipparser/blob/master/parser.go#L138
I print the whole header line and when I look at your error message above it seems the header line was not splitted correctly by "\r\n"

from heplify-server.

negbie avatar negbie commented on June 19, 2024

When I look at your first error I see:

CSeq: 3047 REGISTER\r\n
WWW-Authenticate: Digest realm="..*.",\r\n nonce="xWg1DnB3QqPdiSYw8jsH0g==",algorithm=MD5\r\n

So although its an error for you the parser acts correctly.
As I said the headers will be split by "\r\n"
So it will split the headers like following

CSeq: 3047 REGISTER
WWW-Authenticate: Digest realm="..*.",
nonce="xWg1DnB3QqPdiSYw8jsH0g==",algorithm=MD5

The problem here is that the useragent puts "\r\n" in the middle of the WWW-Authenticate header. Do you know if this is rfc conform?

Same for the second error
Authorization: Digest username="+@...",\r\n realm="...",nonce="aWo/bi1Gr0/Mdgr4aW295Q==",\r\n uri="sip:..*.",\r\n

"\r\n" in the middle of the Authorization header

from heplify-server.

games130 avatar games130 commented on June 19, 2024

I have check the RFC3261, from my understanding, it seems the \r\n are not placed correctly. They did not follow the standard. Will check with my vendor to see if they have an explanation.

from heplify-server.

negbie avatar negbie commented on June 19, 2024

In the best case they will fix it but it will take a while. What I can do is to check if we have at least the mandatory sip headers and go ahead with the processing. It seems I handle sip parsing errors to strict right now.

from heplify-server.

games130 avatar games130 commented on June 19, 2024

Got a feedback from the vendor, i miss out one of the syntax. So actually the syntax is correct (the \r\n is placed correctly - it is an optional part)

RFC3261:
WWW-Authenticate = "WWW-Authenticate" HCOLON challenge
challenge = ("Digest" LWS digest-cln *(COMMA digest-cln))
COMMA = SWS "," SWS ; comma
SWS = [ LWS ] ; sep whitespace
LWS = [ WSP CRLF ] 1WSP ; linear whitespace

Did some testing on my own for changes to parser.go at the sipparser. I commented out the error reporting for "no semi found in xxx" and manually set sp=0. I figure that since there is no semi, it is not a header anyways so it can be ignored.

func (s *SipMsg) addHdr(str string) {
	if str == "" || str == " " {
		return
	}
	sp := strings.IndexRune(str, ':')
	if sp == -1 {
		sp = 0
		//s.Error = fmt.Errorf("addHdr err: no semi found in: %s", str)
		//return
	}

from heplify-server.

negbie avatar negbie commented on June 19, 2024

Try to comment only the error message

from heplify-server.

games130 avatar games130 commented on June 19, 2024

Owww thats a much better way of doing it. don't need to continue processing since it is not a header.
I tried it, it is working well.

from heplify-server.

negbie avatar negbie commented on June 19, 2024

Fixed with latest commit.

from heplify-server.

games130 avatar games130 commented on June 19, 2024

thank you 😄

from heplify-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.