Bug fixes. HTTP parsing improvements. More tests.

Fixed TcpSocket::set_descriptor(nullptr) causing an invalid read from address 0x0.

Improved HTTP response/request parsing so that they report a parse failure if the first few bytes of the HTTP request don't match the expected format rather than continuing to look for an end of header.

Fixed broken fr::Http::url_encode() implementation.

Optimised fr::Http::url_decode() implementation.

Added fr::Http unit tests.
This commit is contained in:
Fred Nicolson
2018-03-01 15:51:57 +00:00
parent 62d8b7ba63
commit 103e0faaae
12 changed files with 184 additions and 77 deletions
+1
View File
@@ -92,6 +92,7 @@ TEST(HttpResponseTest, header_length_test)
//Try data with no header end first
std::string buff(MAX_HTTP_HEADER_SIZE + 1, '\0');
fr::HttpResponse response;
buff.insert(0, "HTTP");
ASSERT_EQ(response.parse(buff.c_str(), buff.size()), fr::Socket::HttpHeaderTooBig);
response = {};