tinywebd
diff src/http.c @ 4:9e054c002489
fixed the header parsing bugs
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 16 Apr 2015 17:34:15 +0300 |
parents | 852a745503cf |
children | def49a046566 |
line diff
1.1 --- a/src/http.c Thu Apr 16 15:20:16 2015 +0300 1.2 +++ b/src/http.c Thu Apr 16 17:34:15 2015 +0300 1.3 @@ -146,11 +146,12 @@ 1.4 1.5 startln = buf; 1.6 endln = buf; 1.7 - for(i=1; i<hdr->body_offset; i++) { 1.8 + for(i=1; i<hdr->body_offset - 2; i++) { 1.9 if(buf[i] == '\n' && buf[i - 1] == '\r') { 1.10 int linesz; 1.11 + 1.12 endln = buf + i - 1; 1.13 - linesz = endln - startln - 1; 1.14 + linesz = endln - startln; 1.15 1.16 if(startln > buf) { /* skip first line */ 1.17 int idx = hdr->num_hdrfields++;