[Asterisk-Users] SIP register problem
Karl Brose
khb at brose.com
Tue Nov 16 12:29:17 MST 2004
Just checked the RFC, and it does say that a tab is acceptable.
SIP header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
This is intended to behave exactly as HTTP/1.1 as described in RFC
2616 [8]. The SWS construct is used when linear white space is
optional, generally between tokens and separators.
LWS = [*WSP CRLF] 1*WSP ; linear whitespace
SWS = [LWS] ; sep whitespace
This means that Asterisk is broken.
Please try the patch attached to this e-mail
filename is lws2sws.patch.txt
Just in case, here is how to:
copy the patch to your Asterisk source code channels directory:
(assuming that /usr/src/asterisk is your base)
cp lws2sws.patch.txt /usr/src/asterisk/channel
cd /usr/src/asterisk/channels
It would be safer to make a backup copy of chan_sip.c before patching.
patch chan_sip.c <lws2sws.patch.txt
cd ..
then recompile asterisk and install the new chan_sip.so file
test with pedantic=yes
unless you removed the if clause
-------------- next part --------------
--- chan_sip.c 2004-11-16 14:14:42.000000000 -0500
+++ chan_sip.c_lws 2004-11-16 14:18:44.000000000 -0500
@@ -2499,33 +2499,32 @@
}
/* Check for end-of-line */
if (msgbuf[h] == '\n') {
- /* Check for end-of-message */
+ /* Check for end-of-message */
if (h + 1 == len)
- break;
- /* Check for a continuation line */
- if (msgbuf[h + 1] == ' ') {
- /* Merge continuation line */
- h++;
+ break;
+ /* Check for a continuation line */
+ if (msgbuf[h + 1] == ' ' || msgbuf[h + 1] == '\t') {
+ /* Merge continuation line */
+ h++;
+ continue;
+ }
+ /* Propagate LF and start new line */
+ msgbuf[t++] = msgbuf[h++];
+ lws = 0;
continue;
}
- /* Propagate LF and start new line */
- msgbuf[t++] = msgbuf[h++];
- lws = 0;
- continue;
- }
-
- if (msgbuf[h] == ' ' || msgbuf[h] == '\t') {
- if (lws) {
- h++;
+ if (msgbuf[h] == ' ' || msgbuf[h] == '\t') {
+ if (lws) {
+ h++;
+ continue;
+ }
+ msgbuf[t++] = msgbuf[h++];
+ lws = 1;
continue;
}
msgbuf[t++] = msgbuf[h++];
- lws = 1;
- continue;
- }
- msgbuf[t++] = msgbuf[h++];
- if (lws)
- lws = 0;
+ if (lws)
+ lws = 0;
}
msgbuf[t] = '\0';
return t;
More information about the asterisk-users
mailing list