summaryrefslogtreecommitdiff
path: root/test/request.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2005-04-24 08:00:59 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2005-04-24 08:00:59 +0000
commite239800e3fce57a69b02585b5cfeda8898b5b548 (patch)
tree97957085202319104da605e9e8b6fee8405c241a /test/request.c
parent456d7ca5b387cacd4587a7fe32e05ac349cc6698 (diff)
downloadneon-e239800e3fce57a69b02585b5cfeda8898b5b548.tar.gz
* test/request.c (send_bad_offset): Use an empty file and a negative
offset rather than /dev/null. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@586 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/request.c')
-rw-r--r--test/request.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/request.c b/test/request.c
index ce3c787..75f7693 100644
--- a/test/request.c
+++ b/test/request.c
@@ -797,7 +797,7 @@ static int reset_headers(void)
"X-Foo: bar\r\n" "\r\n"
"HTTP/1.1 200 Thank you kindly\r\n"
- "Connection: close\r\n"
+ "Content-Length: 0\r\n"
"X-Foo: hello fair world\r\n" "\r\n"));
ne_hook_post_send(sess, post_send_retry, NULL);
@@ -1750,19 +1750,25 @@ static int send_bad_offset(void)
{
ne_session *sess;
ne_request *req;
- int ret, fd = open("/dev/null", O_RDONLY);
-
- ONN("missing /dev/null!", fd < 0);
+ char *fn = "empty.txt";
+ int ret, fd;
CALL(make_session(&sess, single_serve_string,
RESP200 "Content-Length: 0\r\n" "\r\n"));
+ fd = open(fn, O_RDWR|O_CREAT);
+
+ ONV(fd < 0, ("could not find %s", fn));
+
req = ne_request_create(sess, "PUT", "/null");
- ne_set_request_body_fd(req, fd, 500, 5);
+ ne_set_request_body_fd(req, fd, -500, 5);
ret = ne_request_dispatch(req);
+ close(fd);
+ unlink(fn);
+
ONN("request dispatched with bad offset!", ret == NE_OK);
ONV(ret != NE_ERROR,
("request failed with non-NE_ERROR: %s", ne_get_error(sess)));
@@ -1772,7 +1778,6 @@ static int send_bad_offset(void)
reap_server();
ne_request_destroy(req);
- close(fd);
ne_session_destroy(sess);
return OK;
}