mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Make more major improvements to redbean
- POSIX regular expressions for Lua - Improved protocol parsing and encoding - Additional APIs for ZIP storage retrieval - Fix st_mode issue on NT for regular files - Generalized APIs for URL and Host handling - Worked out the kinks in resource resolution - Allow for custom error pages like /404.html
This commit is contained in:
parent
26ac6871da
commit
4effa23528
74 changed files with 3710 additions and 14246 deletions
|
@ -20,13 +20,16 @@
|
|||
#include "net/http/http.h"
|
||||
|
||||
TEST(ParseContentLength, test) {
|
||||
EXPECT_EQ(0, ParseContentLength("", 0));
|
||||
EXPECT_EQ(-1, ParseContentLength(0, 0));
|
||||
EXPECT_EQ(-1, ParseContentLength("", 0));
|
||||
EXPECT_EQ(-1, ParseContentLength("-1", 2));
|
||||
EXPECT_EQ(-1, ParseContentLength("-2", 2));
|
||||
EXPECT_EQ(-1, ParseContentLength("e", -1));
|
||||
EXPECT_EQ(-1, ParseContentLength(",", -1));
|
||||
EXPECT_EQ(-1, ParseContentLength("\0", 1));
|
||||
EXPECT_EQ(0, ParseContentLength("0", 1));
|
||||
EXPECT_EQ(1, ParseContentLength("1", 1));
|
||||
EXPECT_EQ(0x7fffffff, ParseContentLength("2147483647", 10));
|
||||
EXPECT_EQ(-1, ParseContentLength("2147483648", 10));
|
||||
EXPECT_EQ(-1, ParseContentLength("9223372036854775808", 19));
|
||||
EXPECT_EQ(-1, ParseContentLength("88223372036854775808", 20));
|
||||
EXPECT_EQ(42, ParseContentLength("42, 42", -1)); /* RFC7230 § 3.3.2 */
|
||||
EXPECT_EQ(0x000000ffffffffff, ParseContentLength("1099511627775", -1));
|
||||
EXPECT_EQ(-1, ParseContentLength("1099511627776", -1));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue