I'm building simple http status checker in C. I've got the network part done, but I'm having trouble with string manipulation. Here how it works:
$ ./client http://domain.com/path.html#anchor
200
This utility simply outputs the status of given page on the command line. I need to parse the given string into hostname and request path. I've also built a "template" string with this define:
#define HTTP_GET_MSG "GET %s HTTP/1.1\nUser-Agent: my-agent-0.01\nHost: %s\n\n"
I'd like to know how should I approach the interpolation of parsed url (host and path) into this defined string before send()
ing it to the socket?