diff --git a/README.md b/README.md index 1e08a45..a698d81 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ int main(int argc, const char* argv[]) tcs_socket(&client_socket, TCS_AF_IP4, TCS_SOCK_STREAM, TCS_PROTOCOL_IP_TCP); tcs_connect_str(client_socket, "example.com", 80); - uint8_t send_buffer[] = "GET / HTTP/1.1\nHost: example.com\n\n"; - tcs_send(client_socket, send_buffer, sizeof(send_buffer), TCS_MSG_SENDALL, NULL); + uint8_t send_buffer[] = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"; + tcs_send(client_socket, send_buffer, sizeof(send_buffer) - 1, TCS_MSG_SENDALL, NULL); uint8_t recv_buffer[8192] = {0}; size_t bytes_received = 0; diff --git a/tests/tests.cpp b/tests/tests.cpp index 34c7276..eec06f3 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -103,8 +103,8 @@ TEST_CASE("Example from README") REQUIRE(tcs_socket(&client_socket, TCS_AF_IP4, TCS_SOCK_STREAM, TCS_PROTOCOL_IP_TCP) == TCS_SUCCESS); REQUIRE(tcs_connect_str(client_socket, "example.com", 80) == TCS_SUCCESS); - uint8_t send_buffer[] = "GET / HTTP/1.1\nHost: example.com\n\n"; - CHECK(tcs_send(client_socket, send_buffer, sizeof(send_buffer), TCS_MSG_SENDALL, NULL) == TCS_SUCCESS); + uint8_t send_buffer[] = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n"; + CHECK(tcs_send(client_socket, send_buffer, sizeof(send_buffer) - 1, TCS_MSG_SENDALL, NULL) == TCS_SUCCESS); static uint8_t recv_buffer[8192] = {0}; size_t bytes_received = 0;