Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Confused with event content lengths


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
nik.middleton at noble...
Guest





PostPosted: Sun Jun 28, 2009 1:52 pm    Post subject: [Freeswitch-users] Confused with event content lengths Reply with quote

Hi Guys,

I’m trying to parse events in C++ for an outbound socket. The docs are a little contradictory, so I wonder if someone could help me out.

As I understand it and event is terminated with double LF’s (\n\n) However if there is a Content-Length header the wiki very confusingly says

‘Content-Length is the length of the event beginning AFTER the very next LF only line ("\n") and inclusive the trailing LF/LF pair ("\n\n")’

BUT the example says it’s after the \n\n in the header!! Which is it?

In addition, it also looks like the event body is also terminated by a \n\n. If this is the case, why do I care about content length value, can’t I simply read until I get the termination sequence?

Regards,
Back to top
jmesquita at gmail.com
Guest





PostPosted: Sun Jun 28, 2009 1:58 pm    Post subject: [Freeswitch-users] Confused with event content lengths Reply with quote

If I am not mistaken, you are always safe reading the amount data expressed on Content-Length since it is calculated based on the total message length before it is sent out of FS.

From a protocol point of view, it would indeed be much better to rely on something such as Content-Length then \n\n termination string. As I get to know more and more the core developers, I doubt they would rely on the latter.

Hope it helps...

jmesquita

On Sun, Jun 28, 2009 at 3:49 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Quote:

Hi Guys,
 
I’m trying to parse events in C++ for an outbound socket.  The docs are a little contradictory, so I wonder if someone could help me out.
 
As I understand it and event is terminated with double LF’s (\n\n)  However if there is a Content-Length header the wiki very confusingly says
 
‘Content-Length is the length of the event beginning AFTER the very next LF only line ("\n") and inclusive the trailing LF/LF pair ("\n\n")’
 
BUT the example says it’s after the \n\n in the header!! Which is it?
 
In addition, it also looks like the event body is also terminated by a \n\n.  If this is the case, why do I care about content length value, can’t I simply read until I get the termination sequence?
 
Regards,
 


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Back to top
brian at freeswitch.org
Guest





PostPosted: Sun Jun 28, 2009 2:24 pm    Post subject: [Freeswitch-users] Confused with event content lengths Reply with quote

Yes it says 264 bytes read exactly 264 bytes or die trying.

/b

On Jun 28, 2009, at 1:57 PM, João Mesquita wrote:

Quote:
If I am not mistaken, you are always safe reading the amount data
expressed on Content-Length since it is calculated based on the
total message length before it is sent out of FS.

From a protocol point of view, it would indeed be much better to
rely on something such as Content-Length then \n\n termination
string. As I get to know more and more the core developers, I doubt
they would rely on the latter.

Hope it helps...

jmesquita


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
nik.middleton at noble...
Guest





PostPosted: Sun Jun 28, 2009 2:39 pm    Post subject: [Freeswitch-users] Confused with event content lengths Reply with quote

But from where? After the double LF of the header as one part of the wiki says or after the line containing the content-length that another part of the wiki says?


-----Original Message-----
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Brian West
Sent: 28 June 2009 20:23
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Confused with event content lengths

Yes it says 264 bytes read exactly 264 bytes or die trying.

/b

On Jun 28, 2009, at 1:57 PM, João Mesquita wrote:

Quote:
If I am not mistaken, you are always safe reading the amount data
expressed on Content-Length since it is calculated based on the
total message length before it is sent out of FS.

From a protocol point of view, it would indeed be much better to
rely on something such as Content-Length then \n\n termination
string. As I get to know more and more the core developers, I doubt
they would rely on the latter.

Hope it helps...

jmesquita


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
nik.middleton at noble...
Guest





PostPosted: Sun Jun 28, 2009 5:44 pm    Post subject: [Freeswitch-users] Confused with event content lengths Reply with quote

OK, finally figured it out.

Have updated the Wiki to remove ambiguity and posted some SUDO code

Regards,

-----Original Message-----
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Nik Middleton
Sent: 28 June 2009 20:38
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Confused with event content lengths

But from where? After the double LF of the header as one part of the wiki says or after the line containing the content-length that another part of the wiki says?


-----Original Message-----
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Brian West
Sent: 28 June 2009 20:23
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Confused with event content lengths

Yes it says 264 bytes read exactly 264 bytes or die trying.

/b

On Jun 28, 2009, at 1:57 PM, João Mesquita wrote:

Quote:
If I am not mistaken, you are always safe reading the amount data
expressed on Content-Length since it is calculated based on the
total message length before it is sent out of FS.

From a protocol point of view, it would indeed be much better to
rely on something such as Content-Length then \n\n termination
string. As I get to know more and more the core developers, I doubt
they would rely on the latter.

Hope it helps...

jmesquita


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services