summaryrefslogtreecommitdiffstats
path: root/net/http/http_response_headers_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 04:06:48 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 04:06:48 +0000
commit099cec761ad00232f5ce8483a163356b06065980 (patch)
treec49c284e22db6e8ca8edf7a702c8469f4fbc36a3 /net/http/http_response_headers_unittest.cc
parentfb86b681a52cff45f5dd1137f493d8bf4c1461f2 (diff)
downloadchromium_src-099cec761ad00232f5ce8483a163356b06065980.zip
chromium_src-099cec761ad00232f5ce8483a163356b06065980.tar.gz
chromium_src-099cec761ad00232f5ce8483a163356b06065980.tar.bz2
Portability changes to http_response_headers.
The parsing changes will also behave differently for these cases (added as unit-tests): "Content-Length: +10\n" Before: 10 After: -1 "Content-Length: 40000000000000000000\n" Before: 9223372036854775807 After: -1 "Content-Length: \v10\n" Before: 10 After: -1 "Content-Length: \f10\n" Before: 10 After: -1 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers_unittest.cc')
-rw-r--r--net/http/http_response_headers_unittest.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 41b7c563..45bcaaa 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -896,6 +896,10 @@ TEST(HttpResponseHeadersTest, GetContentLength) {
-1
},
{ "HTTP/1.1 200 OK\n"
+ "Content-Length: +10\n",
+ -1
+ },
+ { "HTTP/1.1 200 OK\n"
"Content-Length: 23xb5\n",
-1
},
@@ -903,6 +907,43 @@ TEST(HttpResponseHeadersTest, GetContentLength) {
"Content-Length: 0xA\n",
-1
},
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: 010\n",
+ 10
+ },
+ // Content-Length too big, will overflow an int64
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: 40000000000000000000\n",
+ -1
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: 10\n",
+ 10
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: 10 \n",
+ 10
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: \t10\n",
+ 10
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: \v10\n",
+ -1
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: \f10\n",
+ -1
+ },
+ { "HTTP/1.1 200 OK\n"
+ "cOnTeNt-LENgth: 33\n",
+ 33
+ },
+ { "HTTP/1.1 200 OK\n"
+ "Content-Length: 34\r\n",
+ -1
+ },
};
for (size_t i = 0; i < arraysize(tests); ++i) {
string headers(tests[i].headers);