cybersecurity · intermediate · ~15 min · safe pentest lab
Read structured headers out of HTTP response text.
Implement int find_header(const char *response, const char *name, char *out, size_t out_sz) that returns 0 if the named header exists in the HTTP response (case-insensitive name), writes the trimmed value to out, and -1 otherwise.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stddef.h>
int find_header(const char *response, const char *name, char *out, size_t out_sz) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.