Git Product home page Git Product logo

Comments (6)

0x19 avatar 0x19 commented on May 26, 2024

@MehSha hey!

Ok so I have no time at this moment to fix it but EOF means End Of File.

See this: https://github.com/0x19/goesl/blob/master/examples/client.go#L54

if !strings.Contains(err.Error(), "EOF") 

What I would do on your place is just not treat EOF as error. I will attach later on code that will do the same.

For malformed MIME. Can you please give me a little bit more info, panic, data, something as it's very hard like this to tell what's the problem.

Thanks!

from goesl.

htrendev avatar htrendev commented on May 26, 2024

I have the same malformed MIME problem. Part of the JSON gets parsed as a header. It looks as if part of the text in the buffer is somehow skipped, which leads to incorrect parsing of the next message in the buffer and as a result an "unexpected end of JSON input" error occurs. Is it possible that the buffer is somehow overwritten/changed between the reads?

I can reproduce this 100%. It seems to happen when two events come at almost exactly the same time. The Content-Length header is then pre-pended with some JSON. The JSON part is in fact from the previous event in the stream. It looks like this:

map[{"Event-Name":["RE_SCHEDULE","Core-UUID":"5394f610-9504-4d11-a8e7-86f60fd13331","FreeSWITCH-Hostname":"fs1.example.com","FreeSWITCH-Switchname":"fs1.example.com","FreeSWITCH-IPv4":"10.10.10.10","FreeSWITCH-IPv6":"::1","Event-Date-Local":"2015-09-16 18:07:03","Event-Date-GMT":"Wed, 16 Sep 2015 16:07:03 GMT","Event-Date-Timestamp":"1442419623317552","Event-Calling-File":"switch_scheduler.c","Event-Calling-Function":"switch_scheduler_execute","Event-Calling-Line-Number":"71","Event-Sequence":"620500","Task-ID":"1","Task-Desc":"heartbeat","Task-Group":"core","Task-Runtime":"1442419643"}Content-Length: 608] Content-Type:[text/event-json]]

I have verified with a packet capture that the headers are correctly formatted and that the JSON is valid.

I also tried ignoring the "unexpected end of JSON input" error as suggested, but after that no more events get processed.

from goesl.

MehSha avatar MehSha commented on May 26, 2024

any fix, or any hint to fix it is much appreciated.

from goesl.

htrendev avatar htrendev commented on May 26, 2024

If that helps, I have also tested with https://github.com/fiorix/go-eventsocket and it parses all messages correctly. Maybe there is a hint in this code, which may help you identify the problem?

from goesl.

0x19 avatar 0x19 commented on May 26, 2024

@MehSha and @htrendev thx on this finding! I will really do my best to get on this as soon as possible. Will try to get some time scheduled for this today or tomorrow.

from goesl.

avbdr avatar avbdr commented on May 26, 2024

offered patch is fixing a problem

from goesl.

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.