Re: Strange bug with the XMLRPC Interface



On 3/9/2006, "Tom Parker" <palfrey tevp net> wrote:
> Odds are the
>Performancing plugin strips leading whitespace, and drivel could do the
>same (very untested patch to hack this in also attached), but that's up
>to the main developers whether they want to do this or not.

Whoops. Forgot to attach. Fixed.

Tom
--- src/network.c.old	2006-03-09 17:34:46.665386000 +0100
+++ src/network.c	2006-03-09 18:01:57.434643000 +0100
@@ -62,14 +62,25 @@
 write_cb (void *ptr, size_t size, size_t nmemb, void *data)
 {
 	gint realsize = size * nmemb;
+	gint bufsize = realsize;
 	DrivelRequestData *memory = data;
 
-	memory->data = (gchar *) g_realloc (memory->data, memory->len + realsize + 1);
-
-	memcpy (&(memory->data [memory->len]), ptr, realsize);
-	memory->len += realsize;
-	memory->data [memory->len] = '\0';
+	if (memory->len == 0)
+	{
+		while(bufsize>0 && (((gchar*)ptr)[0]=='\n' || ((gchar*)ptr)[0]==' ' || ((gchar*)ptr)[0] == '\t'))
+		{
+			ptr++;
+			bufsize--;
+		}
+	}
+	if (bufsize>0)
+	{
+		memory->data = (gchar *) g_realloc (memory->data, memory->len + bufsize + 1);
 
+		memcpy (&(memory->data [memory->len]), ptr, bufsize);
+		memory->len += bufsize;
+		memory->data [memory->len] = '\0';
+	}
 	return realsize;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]