aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorPatrick Monnerat <Patrick.Monnerat@datasphere.ch>2007-10-25 19:40:05 +0000
committerPatrick Monnerat <Patrick.Monnerat@datasphere.ch>2007-10-25 19:40:05 +0000
commit0678a51d3b8be8b24e475929fae11b95d2258da4 (patch)
treece61134dcc831ab685b27300e2d675f1f9c2344c /tests/server
parentb7dd186d3608ae82de103f4e25982047abb816be (diff)
Allow test server to handle binary POSTs.
Tests 35, 544 545 added: binary data POSTs.
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sws.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index e9f5f9384..55c05b199 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -110,7 +110,7 @@ struct httprequest {
};
int ProcessRequest(struct httprequest *req);
-void storerequest(char *reqbuf);
+void storerequest(char *reqbuf, ssize_t totalsize);
#define DEFAULT_PORT 8999
@@ -446,7 +446,7 @@ int ProcessRequest(struct httprequest *req)
return 1;
if(req->cl) {
- if(req->cl <= strlen(end+strlen(END_OF_HEADERS)))
+ if(req->cl <= req->offset - (end - req->reqbuf) - strlen(END_OF_HEADERS))
return 1; /* done */
else
return 0; /* not complete yet */
@@ -456,18 +456,16 @@ int ProcessRequest(struct httprequest *req)
}
/* store the entire request in a file */
-void storerequest(char *reqbuf)
+void storerequest(char *reqbuf, ssize_t totalsize)
{
int error;
ssize_t written;
ssize_t writeleft;
- ssize_t totalsize;
FILE *dump;
if (reqbuf == NULL)
return;
- totalsize = (ssize_t)strlen(reqbuf);
if (totalsize == 0)
return;
@@ -531,7 +529,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
reqbuf[req->offset]=0;
/* dump the request receivied so far to the external file */
- storerequest(reqbuf);
+ storerequest(reqbuf, req->offset);
return DOCNUMBER_INTERNAL;
}
@@ -560,7 +558,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
reqbuf[req->offset]=0;
/* dump the request to an external file */
- storerequest(reqbuf);
+ storerequest(reqbuf, req->offset);
return fail; /* success */
}