@@ -868,6 +868,10 @@ static void test_http_server(void) {
868
868
ASSERT (cmpbody (buf , "hello\n" ) == 0 );
869
869
ASSERT (cmpheader (buf , "C" , "D" ));
870
870
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
+
871
875
// Invalid header: failure
872
876
ASSERT (fetch (& mgr , buf , url , "GET /a.txt HTTP/1.0\nA B\n\n" ) == 0 );
873
877
@@ -1613,6 +1617,22 @@ static void test_http_parse(void) {
1613
1617
s = "a b\n\xc0: 2\n\n" ; // Invalid UTF in the header name: do NOT accept
1614
1618
ASSERT (mg_http_parse (s , strlen (s ), & hm ) == -1 );
1615
1619
}
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
+ }
1616
1636
}
1617
1637
1618
1638
static void ehr (struct mg_connection * c , int ev , void * ev_data ) {
0 commit comments