HTTP: Add utest for http infinite chunked

pull/1882/head
winlin 5 years ago
parent 671af4369b
commit e01b98c91e

@ -723,8 +723,8 @@ VOID TEST(HTTPServerTest, OPTIONSRead)
{
srs_error_t err;
// If OPTIONS, it has no content-length, not chunkted, but not infinite chunked,
// instead, it has no body.
// If request, it has no content-length, not chunked, it's not infinite chunked,
// actually, it has no body.
if (true) {
MockBufferIO io;
io.append("OPTIONS /rtc/v1/play HTTP/1.1\r\n\r\n");
@ -737,6 +737,19 @@ VOID TEST(HTTPServerTest, OPTIONSRead)
EXPECT_TRUE(br->eof());
}
// If response, it has no content-length, not chunked, it's infinite chunked,
if (true) {
MockBufferIO io;
io.append("HTTP/1.1 200 OK\r\n\r\n");
SrsHttpParser hp; HELPER_ASSERT_SUCCESS(hp.initialize(HTTP_RESPONSE, false));
ISrsHttpMessage* req = NULL; HELPER_ASSERT_SUCCESS(hp.parse_message(&io, &req));
SrsAutoFree(ISrsHttpMessage, req);
ISrsHttpResponseReader* br = req->body_reader();
EXPECT_FALSE(br->eof());
}
// So if OPTIONS has body, with chunked or content-length, it's ok to parsing it.
if (true) {
MockBufferIO io;

Loading…
Cancel
Save