[Freeswitch-svn] [commit] r12230 - freeswitch/trunk/libs/esl/src

FreeSWITCH SVN brian at freeswitch.org
Sat Feb 21 17:42:33 PST 2009


Author: brian
Date: Sat Feb 21 19:42:33 2009
New Revision: 12230

Log:
ESL fixes

Modified:
   freeswitch/trunk/libs/esl/src/esl.c

Modified: freeswitch/trunk/libs/esl/src/esl.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl.c	(original)
+++ freeswitch/trunk/libs/esl/src/esl.c	Sat Feb 21 19:42:33 2009
@@ -380,7 +380,7 @@
 
 static void sock_setup(esl_handle_t *handle)
 {
-#ifdef WIN32
+#ifdef WIN32
 	BOOL bOptVal = TRUE;
 	int bOptLen = sizeof(BOOL);
 	setsockopt(handle->sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&bOptVal, bOptLen);
@@ -562,7 +562,7 @@
 			status = ESL_FAIL;
 			goto end;
 		}
-
+		
 		callback(server_sock, client_sock, &echoClntAddr);
 	}
 
@@ -916,31 +916,19 @@
 				}
 				
 				beg = c + 1;
-			}
 
-			free(body);
+				if (*beg == '\n') {
+					beg++;
+					break;
+				}
+			}
 			
 			if ((cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
-				esl_ssize_t sofar = 0;
-		
-				len = atol(cl);
-				body = malloc(len+1);
-				esl_assert(body);
-				*(body + len) = '\0';
-				
-				do {
-					esl_ssize_t r;
-					if ((r = recv(handle->sock, body + sofar, len - sofar, 0)) < 0) {
-						strerror_r(handle->errnum, handle->err, sizeof(handle->err));	
-						goto fail;
-					}
-					sofar += r;
-				} while (sofar < len);
-				
-				handle->last_ievent->body = body;
+				handle->last_ievent->body = strdup(beg);
 			}
-
 			
+			free(body);			
+
 			if (esl_log_level >= 7) {
 				char *foo;
 				esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);



More information about the Freeswitch-svn mailing list