@@ -868,6 +868,10 @@ static void test_http_server(void) {
868868 ASSERT (cmpbody (buf , "hello\n" ) == 0 );
869869 ASSERT (cmpheader (buf , "C" , "D" ));
870870
871+ ASSERT (fetch (& mgr , buf , url , "GET /a.txt HTTP/1.0\nA:\tB\n\n" ) == 200 );
872+ ASSERT (cmpbody (buf , "hello\n" ) == 0 );
873+ ASSERT (cmpheader (buf , "A" , "B" ) == 0 );
874+
871875 // Invalid header: failure
872876 ASSERT (fetch (& mgr , buf , url , "GET /a.txt HTTP/1.0\nA B\n\n" ) == 0 );
873877
@@ -1613,6 +1617,22 @@ static void test_http_parse(void) {
16131617 s = "a b\n\xc0: 2\n\n" ; // Invalid UTF in the header name: do NOT accept
16141618 ASSERT (mg_http_parse (s , strlen (s ), & hm ) == -1 );
16151619 }
1620+
1621+ {
1622+ struct mg_http_message hm ;
1623+ const char * s ;
1624+ s = "a b c\nd:e\n\n" ;
1625+ ASSERT (mg_http_parse (s , strlen (s ), & hm ) == (int ) strlen (s ));
1626+ s = "a b c\nd: e\n\n" ;
1627+ ASSERT (mg_http_parse (s , strlen (s ), & hm ) == (int ) strlen (s ));
1628+ s = "a b c\nd:\te\n\n" ;
1629+ ASSERT (mg_http_parse (s , strlen (s ), & hm ) == (int ) strlen (s ));
1630+ s = "a b c\nd:\t e\n\n" ;
1631+ ASSERT (mg_http_parse (s , strlen (s ), & hm ) == (int ) strlen (s ));
1632+ s = "a b c\nd: \te\t \n\n" ;
1633+ ASSERT (mg_http_parse (s , strlen (s ), & hm ) == (int ) strlen (s ));
1634+ ASSERT (mg_strcmp (hm .headers [0 ].value , mg_str ("e" )) == 0 );
1635+ }
16161636}
16171637
16181638static void ehr (struct mg_connection * c , int ev , void * ev_data ) {
0 commit comments