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

Function th_httpd_large_reply

tests/test_httpd.c:3134–3155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3132} th_httpd_large_reply_t;
3133
3134static void *th_httpd_large_reply(void *opaque) {
3135 th_httpd_large_reply_t *reply = opaque;
3136 cbm_http_conn_t *connection = cbm_httpd_accept(reply->listener, 3000);
3137 if (!connection) {
3138 atomic_store(&reply->finished, 1);
3139 return NULL;
3140 }
3141 atomic_store(&reply->accepted, 1);
3142 if (reply->send_deadline_ms)
3143 cbm_http_conn_set_send_deadline_ms(connection, reply->send_deadline_ms);
3144 size_t response_size = 8U * 1024U * 1024U;
3145 char *response = malloc(response_size);
3146 if (response) {
3147 memset(response, 'R', response_size);
3148 cbm_http_reply_buf(connection, 200, "Content-Type: application/octet-stream\r\n", response,
3149 response_size);
3150 free(response);
3151 }
3152 cbm_httpd_conn_close(connection);
3153 atomic_store(&reply->finished, 1);
3154 return NULL;
3155}
3156
3157TEST(httpd_interrupt_unblocks_nonreading_large_response_within_one_second) {
3158 cbm_httpd_t *listener = cbm_httpd_listen(0);

Callers

nothing calls this directly

Calls 4

cbm_httpd_acceptFunction · 0.85
cbm_http_reply_bufFunction · 0.85
cbm_httpd_conn_closeFunction · 0.85

Tested by

no test coverage detected