cybersecurity · intermediate · ~15 min · safe pentest lab
Pull the path out of a request line.
Implement int request_path(const char *line, char *out, int outsz) copying the second token (path) of METHOD PATH VERSION into out, returning its length, or -1 if there aren't two spaces.
#include <string.h>
int request_path(const char *line, char *out, int outsz) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.