[librest] rest-proxy-call: Include the zero byte added by soup to the payload



commit 44a8807768cc0a30e03151780582c1f00170ab38
Author: Rob Bradford <rob linux intel com>
Date:   Wed Jul 10 11:25:37 2013 +0100

    rest-proxy-call: Include the zero byte added by soup to the payload
    
    In the previous commit the downloading of binary data was fixed -
    unfortunately this broke the behaviour of downloading textual data where
    the clients expect a NUL terminated string for the payload.
    
    This change makes sure to include the zero byte that soup adds to
    support this use case and as a result the test suite passes.

 rest/rest-proxy-call.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index c84291e..a6533c3 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -608,7 +608,8 @@ finish_call (RestProxyCall *call, SoupMessage *message, GError **error)
       (SoupMessageHeadersForeachFunc)_populate_headers_hash_table,
       priv->response_headers);
 
-  priv->payload = g_memdup (message->response_body->data, message->response_body->length);
+  priv->payload = g_memdup (message->response_body->data,
+                            message->response_body->length + 1);
   priv->length = message->response_body->length;
 
   priv->status_code = message->status_code;


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