MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / th_httpd_large_reply

Function th_httpd_large_reply

tests/test_httpd.c:1656–1675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1654} th_httpd_large_reply_t;
1655
1656static void *th_httpd_large_reply(void *opaque) {
1657 th_httpd_large_reply_t *reply = opaque;
1658 cbm_http_conn_t *connection = cbm_httpd_accept(reply->listener, 3000);
1659 if (!connection) {
1660 atomic_store(&reply->finished, 1);
1661 return NULL;
1662 }
1663 atomic_store(&reply->accepted, 1);
1664 size_t response_size = 8U * 1024U * 1024U;
1665 char *response = malloc(response_size);
1666 if (response) {
1667 memset(response, 'R', response_size);
1668 cbm_http_reply_buf(connection, 200, "Content-Type: application/octet-stream\r\n", response,
1669 response_size);
1670 free(response);
1671 }
1672 cbm_httpd_conn_close(connection);
1673 atomic_store(&reply->finished, 1);
1674 return NULL;
1675}
1676
1677TEST(httpd_interrupt_unblocks_nonreading_large_response_within_one_second) {
1678 cbm_httpd_t *listener = cbm_httpd_listen(0);

Callers

nothing calls this directly

Calls 3

cbm_httpd_acceptFunction · 0.85
cbm_http_reply_bufFunction · 0.85
cbm_httpd_conn_closeFunction · 0.85

Tested by

no test coverage detected