sipmsg: incorrect check for missing Content-Length
authorStefan Becker <chemobejk@gmail.com>
Fri, 12 Jul 2013 22:25:07 +0000 (13 01:25 +0300)
committerStefan Becker <chemobejk@gmail.com>
Sat, 13 Jul 2013 12:55:50 +0000 (13 15:55 +0300)
Content-Length is only mandatory when Content-Type is present. This
isn't a problem for the purple backend, but the telepathy backend aborts
on fatal error messages.

Noticed with a 302 HTTP response during Office 365 EWS autodiscover.

(cherry picked from commit e627a0cadd672c5e9948dabf903545929c89cae6)

src/core/sipmsg.c

index 5e6cdff..778f61a 100644 (file)
@@ -90,7 +90,11 @@ struct sipmsg *sipmsg_parse_header(const gchar *header) {
                if (tmp && sipe_strcase_equal(tmp, "chunked")) {
                        msg->bodylen = SIPMSG_BODYLEN_CHUNKED;
                } else {
-                       SIPE_DEBUG_FATAL_NOFORMAT("sipmsg_parse_header(): Content-Length header not found");
+                       tmp = sipmsg_find_header(msg, "Content-Type");
+                       if (tmp)
+                               SIPE_DEBUG_FATAL_NOFORMAT("sipmsg_parse_header(): Content-Length header not found");
+                       else
+                               msg->bodylen = 0;
                }
        }
        if(msg->response) {