I'm working on pset6. I'm at the part of the main.c
function where I want to start combining the root
and the absolute path.
I was hoping to do something like this:
char* needle = NULL;
char* query = NULL;
needle = strchr(requestTarget, '?');
if (NULL == needle)
{
query[0] = '\0';
}
else
{
query = needle + 1;
}
The point here is to handle the case when there is no ?
in the request path. I keep segmentation faulting when I try make that first if
statement work, and there must be something about strings and char*
and the like that I'm still not getting. When I do pass in things like /cat.jpg? HTTP/1.1
then it works fine -- my query has length 0.
Any hints would be appreciated!