From 2f8b5c84e20edd23e9c3bb5ef2867f82c0ebcd56 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Mar 2010 22:11:43 +0000 Subject: [PATCH] fix cosmetic change to avoid double content-length header git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16978 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/esl/src/esl_event.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index b89711d2dd..bdeffb82bd 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -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");