Check we got a full read when serving local files over HTTP.
This commit is contained in:
parent
dfe3d7af12
commit
22c90415be
2
net_io.c
2
net_io.c
|
@ -1391,7 +1391,7 @@ static int handleHTTPRequest(struct client *c, char *p) {
|
|||
if (!strncmp(hrp, rp, strlen(hrp))) {
|
||||
if (stat(getFile, &sbuf) != -1 && (fd = open(getFile, O_RDONLY)) != -1) {
|
||||
content = (char *) realloc(content, sbuf.st_size);
|
||||
if (read(fd, content, sbuf.st_size) != -1) {
|
||||
if (read(fd, content, sbuf.st_size) == sbuf.st_size) {
|
||||
clen = sbuf.st_size;
|
||||
statuscode = 200;
|
||||
statusmsg = "OK";
|
||||
|
|
Loading…
Reference in a new issue