[asterisk-bugs] [Asterisk 0017326]: [patch] Computation of Content-Length is wrong under some circumstances

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Jun 22 08:05:16 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17326 
====================================================================== 
Reported By:                kenner
Assigned To:                mnicholson
====================================================================== 
Project:                    Asterisk
Issue ID:                   17326
Category:                   Channels/chan_sip/Interoperability
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           SVN 
JIRA:                       SWP-1451 
Regression:                 No 
Reviewboard Link:           https://reviewboard.asterisk.org/r/693/ 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 262655 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-05-12 10:14 CDT
Last Modified:              2010-06-22 08:05 CDT
====================================================================== 
Summary:                    [patch] Computation of Content-Length is wrong under
some circumstances
Description: 
add_sdp has a bug in the computation of Content-Length.  It first computes
the length by adding together the sizes of a large number of things, then
outputs the length, THEN the things.  That's error-prone if the computation
doesn't agree with what's written.  And, in fact, it doesn't, in some
cases. In each of the cases where it write a dummy media line, that line
isn't included into the count.  This causes interoperability issues with
the Polycom VSX 7000 since it checks the Content-Length.  I have the fairly
obvious patch to account for the length of these lines, but it just makes
the kludge of that part of the code worse.  My recommendation is to not use
add_line, but instead to build up a single string and then take the size of
that string for the header and then outut it.

====================================================================== 

---------------------------------------------------------------------- 
 (0123711) svnbot (reporter) - 2010-06-22 08:05
 https://issues.asterisk.org/view.php?id=17326#c123711 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 271691

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c
U   branches/1.6.2/configs/sip_notify.conf.sample
U   branches/1.6.2/include/asterisk/strings.h

------------------------------------------------------------------------
r271691 | mnicholson | 2010-06-22 08:05:15 -0500 (Tue, 22 Jun 2010) | 25
lines

Merged revisions 271690 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r271690 | mnicholson | 2010-06-22 07:58:28 -0500 (Tue, 22 Jun 2010) | 18
lines
  
  Merged revisions 271689 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r271689 | mnicholson | 2010-06-22 07:52:27 -0500 (Tue, 22 Jun 2010) |
8 lines
    
    Modify chan_sip's packet generation api to automatically calculate the
Content-Length.  This is done by storing packet content in a buffer until
it is actually time to send the packet, at which time the size of the
packet is calculated.  This change was made to ensure that the
Content-Length is always correct.
    
    (closes issue https://issues.asterisk.org/view.php?id=17326)
    Reported by: kenner
    Tested by: mnicholson, kenner
    
    Review: https://reviewboard.asterisk.org/r/693/
  ........
  
  
  This change also adds an ast_str_copy_string() function (similar to
ast_copy_string), that copies one ast_str into another, properly handling
embedded nulls.
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=271691 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-06-22 08:05 svnbot         Checkin                                      
2010-06-22 08:05 svnbot         Note Added: 0123711                          
======================================================================




More information about the asterisk-bugs mailing list