I see, thanks everyone - very helpful. The fact is I'm only really interested in the header, one part even "Host: "
I've decided to read it into a 2K buffer on the stack, find CR-LF-CR-LF and lop the end off. Is that wise?
Or I was thinking of something a little more complex,
Good or crappy way?
int r = 0;
char * header = NULL;
while((r = recv(sock, buf, sizeof(buf), 0)) == sizeof(buf))
/* add buf to header (realloc and strcat) */
/* search through 'header' (from the last buf addon) if we find \r\n\r\n stop */