166,8 → 166,9 |
if (byteread > 0) { |
buffer[byteread] = 0; |
lastactivity = time(NULL); |
/* do I know the http code yet? */ |
if (httpcode < 0) { |
/* are headers done already? */ |
if (headersdone == 0) { |
if (httpcode < 0) { /* do I know the http code yet? */ |
int spc; |
/* find the first space (HTTP/1.1 200 OK) */ |
for (spc = 0; spc < 16; spc++) { |
191,9 → 192,8 |
} |
} |
/* skip headers: look for \r\n\r\n or \n\n within the stream */ |
if (headersdone == 0) { |
byteread = detecthttpheadersend(buffer, byteread); |
headersdone = 1; |
headersdone = 1; /* assumes ALL headers are contained in the first packet TODO FIXME */ |
if (byteread == 0) continue; |
} |
/* if downloading to file, write stuff to disk */ |