summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-06-27 20:28:02 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-06-27 20:28:02 +0100
commit611b1961b81552737ae9345dac12a3f1cd914212 (patch)
tree9987fca2e8138179f8e256a4932a4c1d024d1d55 /test/src
parent4833456868dd4370c3ab5c79dc1e1812dbb8a36d (diff)
downloadexim4-611b1961b81552737ae9345dac12a3f1cd914212.tar.gz
Restore rsmapd support
Following discussions on the exim-user mailinglist it seems that the conclusion that the interface was nonfunctioning was unwarranted.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/server.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/src/server.c b/test/src/server.c
index 719350c15..d433ebe0e 100644
--- a/test/src/server.c
+++ b/test/src/server.c
@@ -519,6 +519,11 @@ s = script;
for (count = 0; count < connection_count; count++)
{
+ struct {
+ int left;
+ BOOL in_use;
+ } content_length = { 0, FALSE };
+
alarm(timeout);
if (port <= 0)
{
@@ -729,6 +734,7 @@ for (count = 0; count < connection_count; count++)
alarm(timeout);
n = read(dup_accept_socket, CS buffer+offset, s->len - offset);
+ if (content_length.in_use) content_length.left -= n;
if (n == 0)
{
printf("%sxpected EOF read from client\n",
@@ -746,8 +752,9 @@ for (count = 0; count < connection_count; count++)
if (data) do
{
n = (read(dup_accept_socket, &c, 1) == 1 && c == '.');
+ if (content_length.in_use) content_length.left--;
while (c != '\n' && read(dup_accept_socket, &c, 1) == 1)
- ;
+ if (content_length.in_use) content_length.left--;
} while (!n);
else if (memcmp(ss, buffer, n) != 0)
{
@@ -770,7 +777,8 @@ for (count = 0; count < connection_count; count++)
goto END_OFF;
}
alarm(0);
- n = (int)strlen(CS buffer);
+ n = strlen(CS buffer);
+ if (content_length.in_use) content_length.left -= (n - offset);
while (n > 0 && isspace(buffer[n-1])) n--;
buffer[n] = 0;
printf("%s\n", buffer);
@@ -784,6 +792,11 @@ for (count = 0; count < connection_count; count++)
break;
}
}
+
+ if (sscanf(CCS buffer, "<Content-length: %d", &content_length.left))
+ content_length.in_use = TRUE;
+ if (content_length.in_use && content_length.left <= 0)
+ shutdown(dup_accept_socket, SHUT_RD);
}
}