summaryrefslogtreecommitdiff
path: root/test/request.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2005-01-21 23:47:55 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2005-01-21 23:47:55 +0000
commit90d8217d9044379752dae1e8bb2f74c257a6608f (patch)
tree9cf5d5b364f1758fc9b2f34093d31c4b7225208f /test/request.c
parent566e168b33af8c65034a590b73941550997b4482 (diff)
downloadneon-90d8217d9044379752dae1e8bb2f74c257a6608f.tar.gz
* test/request.c (fail_on_invalid): Rename from fail_corrupt_chunks;
test for invalid C-L in response. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@444 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/request.c')
-rw-r--r--test/request.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/request.c b/test/request.c
index 0cf124b..dcd0a66 100644
--- a/test/request.c
+++ b/test/request.c
@@ -1,6 +1,6 @@
/*
HTTP request handling tests
- Copyright (C) 2001-2004, Joe Orton <joe@manyfish.co.uk>
+ Copyright (C) 2001-2005, Joe Orton <joe@manyfish.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -770,7 +770,7 @@ static int strip_http10_connhdr2(void)
return expect_header_value("X-Widget", NULL,
single_serve_string,
"HTTP/1.0 200 OK\r\n"
- "Connection: connection, x-widget\r\n"
+ "Connection: connection, x-fish, x-widget\r\n"
"x-widget: blah\r\n"
"Content-Length: 0\r\n"
"\r\n");
@@ -1549,20 +1549,29 @@ static int fail_long_header(void)
return invalid_response_gives_error(resp, "Line too long");
}
-static int fail_corrupt_chunks(void)
+static int fail_on_invalid(void)
{
static const struct {
const char *resp, *error;
} ts[] = {
- /* not CRLF */
+ /* chunk without trailing CRLF */
{ RESP200 TE_CHUNKED "\r\n" "5\r\n" "abcdeFISH",
"delimiter was invalid" },
- /* short CRLF */
+ /* chunk with CR then EOF */
{ RESP200 TE_CHUNKED "\r\n" "5\r\n" "abcde\n",
"not read chunk delimiter" },
- /* CR-notLF */
+ /* chunk with CR then notLF */
{ RESP200 TE_CHUNKED "\r\n" "5\r\n" "abcde\rZZZ",
"delimiter was invalid" },
+
+ /* negative C-L */
+ { RESP200 "Content-Length: -1\r\n" "\r\n" "abcde",
+ "Invalid Content-Length" },
+ /* stupidly-large C-L */
+ { RESP200 "Content-Length: 99999999999999999999999999\r\n"
+ "\r\n" "abcde",
+ "Invalid Content-Length" },
+
{ NULL, NULL }
};
int n;
@@ -1848,7 +1857,7 @@ ne_test tests[] = {
T(fail_eof_chunk),
T(fail_eof_badclen),
T(fail_long_header),
- T(fail_corrupt_chunks),
+ T(fail_on_invalid),
T(read_timeout),
T(fail_lookup),
T(fail_double_lookup),