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

Function th_http

tests/test_httpd.c:123–134  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

121
122/* One-shot HTTP exchange. Returns response length, 0 on connect failure. */
123static int th_http(int port, const char *request, char *resp, size_t respsz) {
124 th_sock_t s = th_connect(port);
125 if (s == TH_SOCK_BAD)
126 return 0;
127 if (th_send_all(s, request, strlen(request)) != 0) {
128 th_sock_close(s);
129 return 0;
130 }
131 int n = th_recv_until_close(s, resp, respsz);
132 th_sock_close(s);
133 return n;
134}
135
136/* HTTP status code from a raw response ("HTTP/1.1 404 ..."), or -1. */
137static int th_status(const char *resp) {

Callers 2

ui_delete_requestFunction · 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