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

Function th_http_raw

tests/test_httpd.c:136–147  ·  view source on GitHub ↗

One-shot raw HTTP exchange. Returns response length, 0 on connect failure. */

Source from the content-addressed store, hash-verified

134
135/* One-shot raw HTTP exchange. Returns response length, 0 on connect failure. */
136static int th_http_raw(int port, const char *request, char *resp, size_t respsz) {
137 th_sock_t s = th_connect(port);
138 if (s == TH_SOCK_BAD)
139 return 0;
140 if (th_send_all(s, request, strlen(request)) != 0) {
141 th_sock_close(s);
142 return 0;
143 }
144 int n = th_recv_until_close(s, resp, respsz);
145 th_sock_close(s);
146 return n;
147}
148
149/* Existing route tests focus on endpoint behavior. Add the loopback Host and
150 * JSON mutation header the browser supplies. Security tests use th_http_raw()

Callers 2

th_httpFunction · 0.85
test_httpd.cFile · 0.85

Calls 3

th_connectFunction · 0.85
th_send_allFunction · 0.85
th_recv_until_closeFunction · 0.85

Tested by

no test coverage detected