Lines Matching +full:- +full:- +full:no +full:- +full:check +full:- +full:certificate

1 /* Copyright (c) 2015-2018 the Civetweb developers
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53 /* This unit test file uses the excellent Check unit testing library.
55 * http://check.sourceforge.net/doc/check_html/index.html
62 #pragma GCC diagnostic ignored "-Wunused-result"
135 #pragma GCC diagnostic ignored "-Wunreachable-code" in wait_not_null()
136 #pragma GCC diagnostic ignored "-Wunreachable-code-return" in wait_not_null()
164 wd[sizeof(wd) - 1] = 0; in START_TEST()
167 wd[sizeof(wd) - 1] = 0; in START_TEST()
170 /* Check the pem file */ in START_TEST()
186 fprintf(stderr, "Certificate %s not found\n", buf); in START_TEST()
187 exit(1); /* some path is not correct --> test will not work */ in START_TEST()
194 (void)system("cmd /c copy C:\\OpenSSL-Win64\\libeay32.dll libeay32.dll"); in START_TEST()
195 (void)system("cmd /c copy C:\\OpenSSL-Win64\\libssl32.dll libssl32.dll"); in START_TEST()
196 (void)system("cmd /c copy C:\\OpenSSL-Win64\\ssleay32.dll ssleay32.dll"); in START_TEST()
197 (void)system("cmd /c copy C:\\OpenSSL-Win64\\libeay32.dll libeay64.dll"); in START_TEST()
198 (void)system("cmd /c copy C:\\OpenSSL-Win64\\libssl32.dll libssl64.dll"); in START_TEST()
199 (void)system("cmd /c copy C:\\OpenSSL-Win64\\ssleay32.dll ssleay64.dll"); in START_TEST()
201 (void)system("cmd /c copy C:\\OpenSSL-Win32\\libeay32.dll libeay32.dll"); in START_TEST()
202 (void)system("cmd /c copy C:\\OpenSSL-Win32\\libssl32.dll libssl32.dll"); in START_TEST()
203 (void)system("cmd /c copy C:\\OpenSSL-Win32\\ssleay32.dll ssleay32.dll"); in START_TEST()
360 /* Test also tcp_nodelay - this option is not related in test_mg_start_stop_http_server_impl()
440 ck_assert_int_eq(client_ri->status_code, 404); in test_mg_start_stop_http_server_impl()
442 ck_assert_int_eq(client_ri->status_code, 200); in test_mg_start_stop_http_server_impl()
443 /* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */ in test_mg_start_stop_http_server_impl()
471 ck_assert_int_eq(client_ri->status_code, 404); in test_mg_start_stop_http_server_impl()
473 ck_assert_int_eq(client_ri->status_code, 200); in test_mg_start_stop_http_server_impl()
474 /* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */ in test_mg_start_stop_http_server_impl()
484 /* HTTP 1.7 GET request - this HTTP version does not exist */ in test_mg_start_stop_http_server_impl()
503 ck_assert_int_eq(client_ri->status_code, 505); in test_mg_start_stop_http_server_impl()
510 * Multiline header are obsolete with RFC 7230 section-3.2.4 in test_mg_start_stop_http_server_impl()
521 mg_printf(client_conn, "X-Obsolete-Header: something\r\nfor nothing\r\n"); in test_mg_start_stop_http_server_impl()
531 ck_assert_int_eq(client_ri->status_code, 400); in test_mg_start_stop_http_server_impl()
603 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 1] == NULL); in START_TEST()
604 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 2] == NULL); in START_TEST()
676 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
678 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
679 /* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */ in START_TEST()
744 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 1] == NULL); in START_TEST()
745 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 2] == NULL); in START_TEST()
805 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
807 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
808 /* TODO: ck_assert_str_eq(client_ri->request_method, "HTTP/1.0"); */ in START_TEST()
815 /* TODO: A client API using a client certificate is missing */ in START_TEST()
863 "Transfer-Encoding: chunked\r\n" in request_test_handler()
864 "Content-Type: text/plain\r\n\r\n"); in request_test_handler()
897 mg_send_http_ok(conn, "text/plain", -1); in request_test_handler2()
1004 mg_websocket_write(conn, MG_WEBSOCKET_OPCODE_TEXT, "ok - 3", 6); in websock_server_data()
1026 #pragma GCC diagnostic ignored "-Wunreachable-code" in websock_server_data()
1030 #pragma clang diagnostic ignored "-Wunreachable-code" in websock_server_data()
1058 /* Can not send a websocket goodbye message here - in websock_server_close()
1102 pclient_data->clientId, in websocket_client_data_handler()
1108 pclient_data->clientId, in websocket_client_data_handler()
1112 pclient_data->data = malloc(data_len); in websocket_client_data_handler()
1113 ck_assert(pclient_data->data != NULL); in websocket_client_data_handler()
1114 memcpy(pclient_data->data, data, data_len); in websocket_client_data_handler()
1115 pclient_data->len = data_len; in websocket_client_data_handler()
1136 WS_TEST_TRACE("Client %i: Close handler\n", pclient_data->clientId); in websocket_client_close_handler()
1137 pclient_data->closed++; in websocket_client_close_handler()
1143 pclient_data->closed++; in websocket_client_close_handler()
1252 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 1] == NULL); in START_TEST()
1253 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 2] == NULL); in START_TEST()
1270 * of the check unit test framework */ in START_TEST()
1294 for (i = 600; i >= 0; i--) { in START_TEST()
1334 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1344 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1358 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1383 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1399 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1413 ck_assert((client_ri->status_code == 301) || (client_ri->status_code == 302) in START_TEST()
1414 || (client_ri->status_code == 303) in START_TEST()
1415 || (client_ri->status_code == 307) in START_TEST()
1416 || (client_ri->status_code == 308)); /* is a redirect code */ in START_TEST()
1420 ck_assert_int_eq(i, -1); in START_TEST()
1433 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1447 ck_assert((client_ri->status_code == 301) || (client_ri->status_code == 302) in START_TEST()
1448 || (client_ri->status_code == 303) in START_TEST()
1449 || (client_ri->status_code == 307) in START_TEST()
1450 || (client_ri->status_code == 308)); /* is a redirect code */ in START_TEST()
1454 ck_assert_int_eq(i, -1); in START_TEST()
1495 "echo Content-Type: text/plain\r\n" in START_TEST()
1505 "printf \"Content-Type: text/plain\\r\\n\"\n" in START_TEST()
1529 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1531 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1542 /* Check if CGI test executable exists */ in START_TEST()
1557 "e.g. by gcc test/cgi_test.c -o output/cgi_test.cgi\n\n"); in START_TEST()
1575 /* TODO: add test for windows, check with POST */ in START_TEST()
1583 "POST /cgi_test.cgi/x/y.z HTTP/1.0\r\nContent-Length: 3\r\n\r\nABC"); in START_TEST()
1588 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1592 /* Get zipped static data - will not work if Accept-Encoding is not set */ in START_TEST()
1604 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1607 /* Get zipped static data - with Accept-Encoding */ in START_TEST()
1615 "GET /test_gz.txt HTTP/1.0\r\nAccept-Encoding: gzip\r\n\r\n"); in START_TEST()
1622 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1624 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1630 ck_assert_int_eq(client_ri->content_length, 52); in START_TEST()
1650 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1657 while ((i > 0) && ((buf[i - 1] == '\r') || (buf[i - 1] == '\n'))) { in START_TEST()
1658 i--; in START_TEST()
1664 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1686 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1688 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1709 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1711 ck_assert_int_eq(client_ri->status_code, 405); in START_TEST()
1732 ck_assert_int_eq(client_ri->status_code, 405); /* method not allowed */ in START_TEST()
1734 ck_assert_int_eq(client_ri->status_code, 401); /* not authorized */ in START_TEST()
1756 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1782 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1790 * sub-domain */ in START_TEST()
1809 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1836 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
1863 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
1886 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2210 static int g_field_found_return = -999;
2240 strncpy(path, key, pathlen - 8); in field_found()
2259 /* The check unit test library does not have build in memcmp functions. */ in field_get()
2417 int i = (int)fread(buf, 1, sizeof(buf) - 1, f); in field_store()
2467 mg_printf(conn, "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n"); in FormGet()
2474 g_field_found_return = -888; in FormGet()
2503 mg_printf(conn, "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n"); in FormStore()
2593 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 1] == NULL); in START_TEST()
2594 ck_assert(OPTIONS[sizeof(OPTIONS) / sizeof(OPTIONS[0]) - 2] == NULL); in START_TEST()
2639 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2642 /* Handle form: "POST x-www-form-urlencoded" */ in START_TEST()
2653 "Content-Type: application/x-www-form-urlencoded\r\n" in START_TEST()
2654 "Content-Length: 263\r\n" in START_TEST()
2672 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2675 /* Handle form: "POST multipart/form-data" */ in START_TEST()
2677 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2678 "Content-Disposition: form-data; name=\"textin\"\r\n" in START_TEST()
2681 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2682 "Content-Disposition: form-data; name=\"passwordin\"\r\n" in START_TEST()
2685 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2686 "Content-Disposition: form-data; name=\"radio1\"\r\n" in START_TEST()
2689 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2690 "Content-Disposition: form-data; name=radio2\r\n" in START_TEST()
2693 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2694 "Content-Disposition: form-data; name=\"check1\"\r\n" in START_TEST()
2697 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2698 "Content-Disposition: form-data; name=\"numberin\"\r\n" in START_TEST()
2701 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2702 "Content-Disposition: form-data; name=\"datein\"\r\n" in START_TEST()
2705 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2706 "Content-Disposition: form-data; name=\"colorin\"\r\n" in START_TEST()
2709 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2710 "Content-Disposition: form-data; name=\"rangein\"\r\n" in START_TEST()
2713 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2714 "Content-Disposition: form-data; name=\"monthin\"\r\n" in START_TEST()
2717 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2718 "Content-Disposition: form-data; name=\"weekin\"\r\n" in START_TEST()
2721 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2722 "Content-Disposition: form-data; name=\"timein\"\r\n" in START_TEST()
2725 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2726 "Content-Disposition: form-data; name=\"datetimen\"\r\n" in START_TEST()
2729 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2730 "Content-Disposition: form-data; name=\"datetimelocalin\"\r\n" in START_TEST()
2733 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2734 "Content-Disposition: form-data; name=\"emailin\"\r\n" in START_TEST()
2737 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2738 "Content-Disposition: form-data; name=\"searchin\"\r\n" in START_TEST()
2741 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2742 "Content-Disposition: form-data; name=\"telin\"\r\n" in START_TEST()
2745 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2746 "Content-Disposition: form-data; name=\"urlin\"\r\n" in START_TEST()
2749 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2750 "Content-Disposition: form-data; name=\"filein\"; filename=\"\"\r\n" in START_TEST()
2751 "Content-Type: application/octet-stream\r\n" in START_TEST()
2754 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2755 "Content-Disposition: form-data; name=filesin; filename=\r\n" in START_TEST()
2756 "Content-Type: application/octet-stream\r\n" in START_TEST()
2759 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2760 "Content-Disposition: form-data; name=\"selectin\"\r\n" in START_TEST()
2763 "--multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2764 "Content-Disposition: form-data; name=\"message\"\r\n" in START_TEST()
2767 "--multipart-form-data-boundary--see-RFC-2388--\r\n"; in START_TEST()
2780 "Content-Type: multipart/form-data; " in START_TEST()
2781 "boundary=multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2782 "Content-Length: %u\r\n" in START_TEST()
2797 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2801 /* Handle form: "POST multipart/form-data" with chunked transfer encoding */ in START_TEST()
2812 "Content-Type: multipart/form-data; " in START_TEST()
2813 "boundary=multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2814 "Transfer-Encoding: chunked\r\n" in START_TEST()
2823 if (chunk_len > (body_len - body_sent)) { in START_TEST()
2824 chunk_len = body_len - body_sent; in START_TEST()
2844 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2847 /* Handle form: "POST multipart/form-data" with chunked transfer in START_TEST()
2859 "Content-Type: multipart/form-data; " in START_TEST()
2860 "boundary=\"multipart-form-data-boundary--see-RFC-2388\"\r\n" in START_TEST()
2861 "Transfer-Encoding: chunked\r\n" in START_TEST()
2870 if (chunk_len > (body_len - body_sent)) { in START_TEST()
2871 chunk_len = body_len - body_sent; in START_TEST()
2891 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2924 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2928 /* Handle form: "POST x-www-form-urlencoded", chunked, store */ in START_TEST()
2939 "Content-Type: application/x-www-form-urlencoded\r\n" in START_TEST()
2940 "Transfer-Encoding: chunked\r\n" in START_TEST()
2962 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
2965 /* Handle form: "POST multipart/form-data", chunked, store */ in START_TEST()
2976 "Content-Type: multipart/form-data; " in START_TEST()
2977 "boundary=multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
2978 "Transfer-Encoding: chunked\r\n" in START_TEST()
2982 send_chunk_string(client_conn, "--multipart-form-data-boundary"); in START_TEST()
2983 send_chunk_string(client_conn, "--see-RFC-2388\r\n"); in START_TEST()
2984 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
2989 send_chunk_string(client_conn, "--multipart-form-data-boundary-"); in START_TEST()
2990 send_chunk_string(client_conn, "-see-RFC-2388\r\n"); in START_TEST()
2991 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
2996 send_chunk_string(client_conn, "--multipart-form-data-boundary-"); in START_TEST()
2997 send_chunk_string(client_conn, "-see-RFC-2388\r\n"); in START_TEST()
2998 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3003 send_chunk_string(client_conn, "--multipart-form-data-boundary-"); in START_TEST()
3004 send_chunk_string(client_conn, "-see-RFC-2388\r\n"); in START_TEST()
3005 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3009 send_chunk_string(client_conn, "--multipart-form-data-boundary"); in START_TEST()
3010 send_chunk_string(client_conn, "--see-RFC-2388--\r\n"); in START_TEST()
3022 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3026 /* Handle form: "POST multipart/form-data", chunked, store, with files */ in START_TEST()
3037 "Content-Type: multipart/form-data; " in START_TEST()
3038 "boundary=multipart-form-data-boundary--see-RFC-2388\r\n" in START_TEST()
3039 "Transfer-Encoding: chunked\r\n" in START_TEST()
3043 boundary = "--multipart-form-data-boundary--see-RFC-2388\r\n"; in START_TEST()
3046 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3052 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3055 send_chunk_string(client_conn, "Content-Type: "); in START_TEST()
3056 send_chunk_string(client_conn, "application/octet-stream\r\n"); in START_TEST()
3057 send_chunk_string(client_conn, "X-Ignored-Header: xyz\r\n"); in START_TEST()
3070 /* chunks from 1 byte to strlen(boundary)-1 */ in START_TEST()
3078 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3081 send_chunk_string(client_conn, "Content-Type: "); in START_TEST()
3082 send_chunk_string(client_conn, "application/octet-stream\r\n"); in START_TEST()
3083 send_chunk_string(client_conn, "X-Ignored-Header: xyz\r\n"); in START_TEST()
3091 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3097 send_chunk_string(client_conn, "Content-Disposition: form-data; "); in START_TEST()
3101 send_chunk_string(client_conn, "--multipart-form-data-boundary"); in START_TEST()
3102 send_chunk_string(client_conn, "--see-RFC-2388--\r\n"); in START_TEST()
3114 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3212 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3246 ck_assert_int_eq(client_ri->status_code, 401); in START_TEST()
3249 for (i = 0; i < client_ri->num_headers; i++) { in START_TEST()
3250 if (!mg_strcasecmp(client_ri->http_headers[i].name, in START_TEST()
3251 "WWW-Authenticate")) { in START_TEST()
3253 auth_request = client_ri->http_headers[i].value; in START_TEST()
3270 ck_assert_int_gt((ptrdiff_t)(str) - (ptrdiff_t)(auth_request + len), 0); in START_TEST()
3271 ck_assert_int_lt((ptrdiff_t)(str) - (ptrdiff_t)(auth_request + len), in START_TEST()
3276 (size_t)((ptrdiff_t)(str) - (ptrdiff_t)(auth_request + len))); in START_TEST()
3349 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3391 ck_assert_int_eq(client_ri->status_code, 401); in START_TEST()
3419 ck_assert_int_eq(client_ri->status_code, 401); in START_TEST()
3446 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3482 "no", in START_TEST()
3508 "localhost:8081\r\nConnection: keep-alive\r\n\r\n"); in START_TEST()
3517 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
3519 ck_assert_int_eq(client_ri->status_code, 403); in START_TEST()
3523 for (i = 0; i < client_ri->num_headers; i++) { in START_TEST()
3524 if (!mg_strcasecmp(client_ri->http_headers[i].name, "Connection")) { in START_TEST()
3526 connection_header = client_ri->http_headers[i].value; in START_TEST()
3530 /* Error replies will close the connection, even if keep-alive is set. */ in START_TEST()
3611 /* Set to a number - but use a number above the limit */ in START_TEST()
3628 /* HTTP 1.0 GET request - server is not running */ in START_TEST()
3634 /* Error message detail may vary - it may not be empty and should contain in START_TEST()
3658 /* Ask for something not existing - should get default 404 */ in START_TEST()
3674 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
3681 (void)fprintf(f, "err-all"); in START_TEST()
3685 /* Ask for something not existing - should get error.htm */ in START_TEST()
3701 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3707 ck_assert_str_eq(client_err, "err-all"); in START_TEST()
3713 (void)fprintf(f, "err-4xx"); in START_TEST()
3717 /* Ask for something not existing - should get error4xx.htm */ in START_TEST()
3733 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3739 ck_assert_str_eq(client_err, "err-4xx"); in START_TEST()
3745 (void)fprintf(f, "err-404"); in START_TEST()
3749 /* Ask for something not existing - should get error404.htm */ in START_TEST()
3765 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3771 ck_assert_str_eq(client_err, "err-404"); in START_TEST()
3775 /* Ask in a malformed way - should get error4xx.htm */ in START_TEST()
3791 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
3797 ck_assert_str_eq(client_err, "err-4xx"); in START_TEST()
3811 /* HTTP 1.1 GET request - must not work, since server is already stopped */ in START_TEST()
3839 /* File content check var */ in START_TEST()
3883 /* Check status - should be 404 Not Found */ in START_TEST()
3885 ck_assert_int_eq(client_ri->status_code, 404); in START_TEST()
3898 /* Check access.log */ in START_TEST()
3902 ok = (NULL != fgets(buf, sizeof(buf) - 1, f)); in START_TEST()
3912 /* Check error.log */ in START_TEST()
3916 (void)fgets(buf, sizeof(buf) - 1, f); in START_TEST()
3929 OPTIONS[1] = "bad !"; /* no r or s in string */ in START_TEST()
3936 /* Check access.log */ in START_TEST()
3940 (void)fgets(buf, sizeof(buf) - 1, f); in START_TEST()
3948 /* Check error.log */ in START_TEST()
3952 ok = (NULL != fgets(buf, sizeof(buf) - 1, f)); in START_TEST()
3982 ck_assert_str_eq(ri->request_method, "GET"); in test_throttle_begin_request()
3983 ck_assert_str_eq(ri->request_uri, "/throttle"); in test_throttle_begin_request()
3984 ck_assert_str_eq(ri->local_uri, "/throttle"); in test_throttle_begin_request()
3985 ck_assert_str_eq(ri->http_version, "1.0"); in test_throttle_begin_request()
3986 ck_assert_str_eq(ri->query_string, "q"); in test_throttle_begin_request()
3987 ck_assert_str_eq(ri->remote_addr, "127.0.0.1"); in test_throttle_begin_request()
3991 "Content-Length: %lu\r\n" in test_throttle_begin_request()
4019 ck_assert_str_eq(ri->request_method, "GET"); in test_throttle_end_request()
4020 ck_assert_str_eq(ri->request_uri, "/throttle"); in test_throttle_end_request()
4021 ck_assert_str_eq(ri->local_uri, "/throttle"); in test_throttle_end_request()
4022 ck_assert_str_eq(ri->http_version, "1.0"); in test_throttle_end_request()
4023 ck_assert_str_eq(ri->query_string, "q"); in test_throttle_end_request()
4024 ck_assert_str_eq(ri->remote_addr, "127.0.0.1"); in test_throttle_end_request()
4074 strcpy(client_err_buf, "reset-content"); in START_TEST()
4088 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
4090 ck_assert_int_eq(client_ri->content_length, 1024 * 10); in START_TEST()
4094 while (data_read < client_ri->content_length) { in START_TEST()
4100 dt = difftime(t1, t0) * 1000.0; /* Elapsed time in ms - in most systems in START_TEST()
4108 * function is 1 second, so we should add +/- one second tolerance. in START_TEST()
4112 /* Check if there are at least 8 seconds */ in START_TEST()
4158 ck_assert_str_eq(ri->request_method, "GET"); in test_large_file_begin_request()
4159 ck_assert_str_eq(ri->http_version, "1.1"); in test_large_file_begin_request()
4160 ck_assert_str_eq(ri->remote_addr, "127.0.0.1"); in test_large_file_begin_request()
4161 ck_assert_ptr_eq(ri->query_string, NULL); in test_large_file_begin_request()
4162 ck_assert_ptr_ne(ri->local_uri, NULL); in test_large_file_begin_request()
4166 "Content-Length: %lu\r\n" in test_large_file_begin_request()
4269 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
4271 ck_assert_int_eq(client_ri->content_length, LARGE_FILE_SIZE); in START_TEST()
4274 while (data_read < client_ri->content_length) { in START_TEST()
4286 ck_assert_int_eq(r, -1); in START_TEST()
4298 // TODO: Check this problem on AppVeyor in START_TEST()
4328 sprintf(path, "./%s", info->local_uri); in test_mg_store_body_put_delete_handler()
4336 "Content-Type:text/plain;charset=UTF-8\r\n" in test_mg_store_body_put_delete_handler()
4351 "Content-Type:text/plain;charset=UTF-8\r\n" in test_mg_store_body_put_delete_handler()
4376 info->request_method); in test_mg_store_body_begin_request_callback()
4378 if ((strcmp(info->request_method, "PUT") == 0) in test_mg_store_body_begin_request_callback()
4379 || (strcmp(info->request_method, "DELETE") == 0)) { in test_mg_store_body_begin_request_callback()
4445 "PUT /%s HTTP/1.0\r\nContent-Length: %i\r\n\r\n", in START_TEST()
4464 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
4467 r = mg_read(client, client_data_buf, sizeof(client_data_buf) - 1); in START_TEST()
4483 /* Un-initialize the library */ in START_TEST()
4585 ck_assert_int_eq(client_ri->status_code, 200); in START_TEST()
4587 ck_assert_int_eq(client_ri->content_length, FILE_IN_MEM_SIZE); in START_TEST()
4590 while (data_read < client_ri->content_length) { in START_TEST()
4671 /* Check for status code 200 OK or 30? moved */ in minimal_http_https_client_impl()
4672 if ((client_ri->status_code < 300) || (client_ri->status_code > 308)) { in minimal_http_https_client_impl()
4673 ck_assert_int_eq(client_ri->status_code, 200); in minimal_http_https_client_impl()
4677 while (data_read < client_ri->content_length) { in minimal_http_https_client_impl()
4728 /* Un-initialize the library */ in START_TEST()
4757 /* Un-initialize the library */ in START_TEST()
4778 "Content-Length: %lu\r\n" in minimal_test_request_handler()
4779 "Content-Type: text/plain\r\n" in minimal_test_request_handler()
4831 /* Un-initialize the library */ in START_TEST()
4846 * https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ in START_TEST()
4863 /* HTTPS port - required */ in START_TEST()
4867 /* path to certificate file - required */ in START_TEST()
4875 /* set minimum SSL version to TLS 1.2 - recommended */ in START_TEST()
4879 /* set some modern ciphers - recommended */ in START_TEST()
4884 /* set "HTTPS only" header - recommended */ in START_TEST()
4888 /* end of options - required */ in START_TEST()
4924 /* Un-initialize the library */ in START_TEST()
4938 TCase *const tcase_checktestenv = tcase_create("Check test environment"); in make_public_server_suite()
5057 /* Used to debug test cases without using the check framework */
5059 gcc test/public_server.c src/civetweb.c -I include/ -I test/ -l pthread -l dl -D
5060 LOCAL_TEST -D REPLACE_CHECK_FOR_LOCAL_DEBUGGING -D MAIN_PUBLIC_SERVER=main