Skip to content

Instantly share code, notes, and snippets.

@richo
Created January 17, 2013 04:53
Show Gist options
  • Save richo/4553761 to your computer and use it in GitHub Desktop.
Save richo/4553761 to your computer and use it in GitHub Desktop.
int
http_GetHdr(const struct http *hp, const char *hdr, char **ptr)
{
unsigned u, l;
char *p;
l = hdr[0];
diagnostic(l == strlen(hdr + 1));
assert(hdr[l] == ':');
hdr++;
u = http_findhdr(hp, l - 1, hdr);
if (u == 0) {
if (ptr != NULL)
*ptr = NULL;
return (0);
}
if (ptr != NULL) {
p = hp->hd[u].b + l;
while (vct_issp(*p))
p++;
*ptr = p;
}
return (1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment