Subject: [Sipping] Null bytes in SIP bodies ?

From: "Gayraud, Richard" <[email-masked]>
Date: Thu, 14 Jun 2001 11:24:59 +0200

After checking in RFCs 2046 (page 23), it seems to 
me that a SIP body may eventually contain a null 
byte. Perhaps I missed something in the RFCs :-( 

However, I wonder if a SIP proxy really needs to 
support NULL bytes in bodies ? In this case, a simple 
proxy can't carry SIP messages with standard C strings 
(and can't do some basic processing with libc).

Thanks.

Richard Gayraud.

_______________________________________________
Sipping mailing list
[email-masked]
http://www.ietf.org/mailman/listinfo/sipping

---

From: "Henning G. Schulzrinne" <[email-masked]>
Date: Thu, 14 Jun 2001 19:39:34 -0400

> (and can't do some basic processing with libc).

Yes, just like HTTP, a system needs to support any byte value in a body.
If your system supports only SDP and (maybe) HTML, you won't see any
null bytes.

-- 
Henning Schulzrinne   http://www.cs.columbia.edu/~hgs

---

From: [email-masked]
Date: Thu, 14 Jun 2001 11:12:16 -0500

[moving to sip-implementors, as this isn't really a spec issue]

> -----Original Message-----
> From: Gayraud, Richard [mailto:[email-masked]]
> 
...
> support NULL bytes in bodies ?

Yes. It does.

> In this case, a simple 

I can't say that I understand the problem you're running
in to. The body of a SIP message might contain a wide variety
of binary data, such as a small JPEG, an ISUP message, etc.
These almost certainly *will* contain characters that you
can't just handle as normal strings (null in particular).

So, after you read the message headers, use the "content-length"
header to read the remaining message bytes into a buffer. Use
the "content-type" and "content-encoding" to determine how to
handle that buffer. In some cases, you'll be able to handle it as
plain text (e.g. SDP). In others, you'll need to handle it as
pure binary data. In the latter case, it's no different than
if you'd read the data off a disk somewhere: of *course* you
can't treat a JPEG as text; it makes no sense.

A SIP proxy (with rare exception) doesn't even need to go that
far. It can do whatever processing it needs to on the headers,
and store the body off in a buffer. It never looks at that
buffer. When you go to send the message out, just tack that
buffer back on the end. Your proxy (again, with rare exceptions)
should not care *what* the body contains.

/a