]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix cosmetic change to avoid double content-length header
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 12 Mar 2010 22:11:43 +0000 (22:11 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 12 Mar 2010 22:11:43 +0000 (22:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16978 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/src/esl_event.c

index b89711d2dd67dab5f2a45d57e4ce882b4ea1a443..bdeffb82bd7aae77fde3ab2b3d7b70e3fffcbe12 100644 (file)
@@ -441,6 +441,7 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
        size_t llen = 0, dlen = 0, blocksize = 512, encode_len = 1536, new_len = 0;
        char *buf;
        char *encode_buf = NULL;        /* used for url encoding of variables to make sure unsafe things stay out of the serialized copy */
+       int clen = 0;
 
        *str = NULL;
 
@@ -466,7 +467,11 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
                 * destroying loop.
                 */
 
-               
+               if (!strcasecmp(hp->name, "content-length")) {
+                       clen++;
+               }
+
+
                new_len = (strlen(hp->value) * 3) + 1;
 
                if (encode_len < new_len) {
@@ -537,7 +542,7 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
                        }
                }
                
-               if (blen) {
+               if (blen && !clen) {
                        snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", (int)strlen(event->body), event->body);
                } else {
                        snprintf(buf + len, dlen - len, "\n");