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.<br><br>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.<br>
<br>Hope it helps...<br><br>jmesquita<br><br><div class="gmail_quote">On Sun, Jun 28, 2009 at 3:49 PM, Nik Middleton <span dir="ltr"><<a href="mailto:nik.middleton@noblesolutions.co.uk">nik.middleton@noblesolutions.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hi Guys,</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">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.</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">As I understand it and event is terminated with double LF’s
(\n\n) However if there is a </span></font><span lang="EN">Content-Length
header the wiki very confusingly says </span></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN">‘Content-Length is the length of the event
beginning <b><span style="font-weight: bold;">AFTER</span></b> the very next LF
only line ("\n") and <b><span style="font-weight: bold;">inclusive</span></b>
the trailing LF/LF pair ("\n\n")’</span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN">BUT the example says it’s after the \n\n in the
header!! Which is it?</span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN">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?</span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN">Regards, </span></font><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"></span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
</div>
</div>
<br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>