mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	HTTP: Add utest for http infinite chunked
This commit is contained in:
		
							parent
							
								
									671af4369b
								
							
						
					
					
						commit
						e01b98c91e
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue