From de934641be399a853e51f2b9fa8eb21ce9dfe494 Mon Sep 17 00:00:00 2001 From: "Arnout Vandecappelle (Essensium/Mind)" Date: Tue, 2 Nov 2010 11:13:54 +0100 Subject: [PATCH] Test for Issue#200: Multiple calls to mg_read always return same data. --- test/embed.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/embed.c b/test/embed.c index 74c4b999..6efda10e 100644 --- a/test/embed.c +++ b/test/embed.c @@ -54,7 +54,13 @@ static void test_get_var(struct mg_connection *conn, if (!strcmp(ri->request_method, "POST") && cl != NULL) { buf_len = atoi(cl); buf = malloc(buf_len); - mg_read(conn, buf, buf_len); + /* Read in two pieces, to test continuation */ + if (buf_len > 2) { + mg_read(conn, buf, 2); + mg_read(conn, buf + 2, buf_len - 2); + } else { + mg_read(conn, buf, buf_len); + } } else if (ri->query_string != NULL) { buf_len = strlen(ri->query_string); buf = malloc(buf_len + 1);