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

Function copy_header_value

src/ui/httpd.c:447–460  ·  view source on GitHub ↗

Copy a trimmed header value into out. Oversize security headers are rejected, * never silently converted into an apparently absent header. */

Source from the content-addressed store, hash-verified

445/* Copy a trimmed header value into out. Oversize security headers are rejected,
446 * never silently converted into an apparently absent header. */
447static bool copy_header_value(const char *val, const char *val_end, char *out, size_t outsz) {
448 while (val < val_end && (*val == ' ' || *val == '\t'))
449 val++;
450 while (val_end > val && (val_end[-1] == ' ' || val_end[-1] == '\t'))
451 val_end--;
452 size_t n = (size_t)(val_end - val);
453 if (n >= outsz) {
454 out[0] = '\0';
455 return false;
456 }
457 memcpy(out, val, n);
458 out[n] = '\0';
459 return true;
460}
461
462int cbm_http_parse_head(const char *data, size_t len, cbm_http_req_t *req, size_t *body_offset,
463 size_t *content_length) {

Callers 1

cbm_http_parse_headFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected